summaryrefslogtreecommitdiff
path: root/examples/libmsrpc/test/reg
diff options
context:
space:
mode:
Diffstat (limited to 'examples/libmsrpc/test/reg')
-rw-r--r--examples/libmsrpc/test/reg/regdelete.c102
-rw-r--r--examples/libmsrpc/test/reg/regkey.c76
-rw-r--r--examples/libmsrpc/test/reg/regkeycreate.c115
-rw-r--r--examples/libmsrpc/test/reg/regkeyenum.c99
-rw-r--r--examples/libmsrpc/test/reg/regopen.c66
-rw-r--r--examples/libmsrpc/test/reg/regopenkey.c69
-rw-r--r--examples/libmsrpc/test/reg/regqueryval.c79
-rw-r--r--examples/libmsrpc/test/reg/regsetval.c59
-rw-r--r--examples/libmsrpc/test/reg/regvalenum.c103
-rw-r--r--examples/libmsrpc/test/reg/security.c74
-rw-r--r--examples/libmsrpc/test/reg/shutdown.c68
11 files changed, 0 insertions, 910 deletions
diff --git a/examples/libmsrpc/test/reg/regdelete.c b/examples/libmsrpc/test/reg/regdelete.c
deleted file mode 100644
index 50b08ba468..0000000000
--- a/examples/libmsrpc/test/reg/regdelete.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/*tests deleting a key or value*/
-
-#include "libmsrpc.h"
-#include "test_util.h"
-
-int main(int argc, char **argv) {
- CacServerHandle *hnd = NULL;
- TALLOC_CTX *mem_ctx = NULL;
-
- fstring tmp;
- char input = 'v';
-
- mem_ctx = talloc_init("regdelete");
-
- hnd = cac_NewServerHandle(True);
-
- cac_SetAuthDataFn(hnd, cactest_GetAuthDataFn);
-
- cac_parse_cmd_line(argc, argv, hnd);
-
- if(!cac_Connect(hnd, NULL)) {
- fprintf(stderr, "Could not connect to server %s. Error: %s\n", hnd->server, nt_errstr(hnd->status));
- exit(-1);
- }
-
- printf("enter key to open: \n");
- cactest_readline(stdin, tmp);
-
- struct RegOpenKey rok;
- ZERO_STRUCT(rok);
-
- rok.in.name = talloc_strdup(mem_ctx, tmp);
- rok.in.access = REG_KEY_ALL;
-
- if(!cac_RegOpenKey(hnd, mem_ctx, &rok)) {
- fprintf(stderr, "Could not open key %s. Error %s\n", rok.in.name, nt_errstr(hnd->status));
- exit(-1);
- }
-
- printf("getting version (just for testing\n");
-
- struct RegGetVersion rgv;
- ZERO_STRUCT(rgv);
-
- rgv.in.key = rok.out.key;
-
- if(!cac_RegGetVersion(hnd, mem_ctx, &rgv))
- fprintf(stderr, "Could not get version. Error: %s\n", nt_errstr(hnd->status));
- else
- printf("Version: %d\n", rgv.out.version);
-
-
- while(input == 'v' || input == 'k') {
- printf("Delete [v]alue [k]ey or [q]uit: ");
- scanf("%c", &input);
-
- switch(input) {
- case 'v':
- printf("Value to delete: ");
- cactest_readline(stdin, tmp);
-
- struct RegDeleteValue rdv;
- ZERO_STRUCT(rdv);
-
- rdv.in.parent_key = rok.out.key;
- rdv.in.name = talloc_strdup(mem_ctx, tmp);
-
- if(!cac_RegDeleteValue(hnd, mem_ctx, &rdv))
- fprintf(stderr, "Could not delete value %s. Error: %s\n", rdv.in.name, nt_errstr(hnd->status));
-
- break;
- case 'k':
- printf("Key to delete: ");
- cactest_readline(stdin, tmp);
-
- struct RegDeleteKey rdk;
- ZERO_STRUCT(rdk);
-
- rdk.in.parent_key = rok.out.key;
- rdk.in.name = talloc_strdup(mem_ctx, tmp);
-
- printf("delete recursively? [y/n]: ");
- cactest_readline(stdin, tmp);
-
- rdk.in.recursive = (tmp[0] == 'y') ? True : False;
-
- if(!cac_RegDeleteKey(hnd, mem_ctx, &rdk))
- fprintf(stderr, "Could not delete key %s. Error %s\n", rdk.in.name, nt_errstr(hnd->status));
-
- break;
- }
- }
- cac_RegClose(hnd, mem_ctx, rok.out.key);
-
- cac_FreeHandle(hnd);
-
- talloc_destroy(mem_ctx);
-
- return 0;
-}
-
-
diff --git a/examples/libmsrpc/test/reg/regkey.c b/examples/libmsrpc/test/reg/regkey.c
deleted file mode 100644
index a90d06c6ef..0000000000
--- a/examples/libmsrpc/test/reg/regkey.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/*opens and closes a key*/
-
-#include "libmsrpc.h"
-
-int main() {
- CacServerHandle *hnd = NULL;
- TALLOC_CTX *mem_ctx = NULL;
-
- fstring key;
-
- mem_ctx = talloc_init("regkey");
-
- hnd = cac_NewServerHandle(False);
-
- /*allocate some memory so get_auth_data_fn can do it's magic*/
- hnd->username = SMB_MALLOC_ARRAY(char, sizeof(fstring));
- hnd->domain = SMB_MALLOC_ARRAY(char, sizeof(fstring));
- hnd->netbios_name = SMB_MALLOC_ARRAY(char, sizeof(fstring));
- hnd->password = SMB_MALLOC_ARRAY(char, sizeof(fstring));
-
- hnd->server = SMB_MALLOC_ARRAY(char, sizeof(fstring));
-
- printf("Enter server to connect to: ");
- fscanf(stdin, "%s", hnd->server);
-
- printf("Enter key to open: ");
- fscanf(stdin, "%s", key);
-
- if(!cac_Connect(hnd, NULL)) {
- fprintf(stderr, "Could not connect to server.\n Error: %s.\n errno: %s\n", nt_errstr(hnd->status), strerror(errno));
- cac_FreeHandle(hnd);
- exit(-1);
- }
-
- struct RegConnect rc;
- ZERO_STRUCT(rc);
-
- rc.in.access = REG_KEY_ALL;
- rc.in.root = HKEY_LOCAL_MACHINE;
-
- if(!cac_RegConnect(hnd, mem_ctx, &rc)) {
- fprintf(stderr, " Could not connect to registry. %s\n", nt_errstr(hnd->status));
- goto done;
- }
-
- printf("trying to open key %s...\n", key);
-
-
- struct RegOpenKey rok;
- ZERO_STRUCT(rok);
-
- rok.in.parent_key = rc.out.key;
- rok.in.name = key;
- rok.in.access = REG_KEY_ALL;
-
- if(!cac_RegOpenKey(hnd, mem_ctx, &rok)) {
- fprintf(stderr, "Could not open key %s\n Error: %s\n", rok.in.name, nt_errstr(hnd->status));
- goto done;
- }
-
- if(!cac_RegClose(hnd, mem_ctx, rok.out.key)) {
- fprintf(stderr, "Could not close handle %s\n", nt_errstr(hnd->status));
- }
-
- if(!cac_RegClose(hnd, mem_ctx, rc.out.key)) {
- fprintf(stderr, " Could not close handle. %s\n", nt_errstr(hnd->status));
- }
-
-done:
- cac_FreeHandle(hnd);
-
- talloc_destroy(mem_ctx);
-
- return 0;
-
-}
diff --git a/examples/libmsrpc/test/reg/regkeycreate.c b/examples/libmsrpc/test/reg/regkeycreate.c
deleted file mode 100644
index 50764f1682..0000000000
--- a/examples/libmsrpc/test/reg/regkeycreate.c
+++ /dev/null
@@ -1,115 +0,0 @@
-/*tests creating a registry key*/
-
-#include "libmsrpc.h"
-
-#define MAX_KEYS_PER_ENUM 3
-
-int main() {
- CacServerHandle *hnd = NULL;
- TALLOC_CTX *mem_ctx = NULL;
-
- fstring key_name;
-
- fstring key_to_create;
-
- mem_ctx = talloc_init("regcreatekey");
-
- hnd = cac_NewServerHandle(True);
-
- printf("Enter server to connect to: ");
- fscanf(stdin, "%s", hnd->server);
-
- printf("Enter key to open: ");
- fscanf(stdin, "%s", key_name);
-
- printf("Enter key to create: ");
- fscanf(stdin, "%s", key_to_create);
-
- if(!cac_Connect(hnd, NULL)) {
- fprintf(stderr, "Could not connect to server.\n Error: %s.\n errno: %s\n", nt_errstr(hnd->status), strerror(errno));
- cac_FreeHandle(hnd);
- exit(-1);
- }
-
- printf("trying to open key %s...\n", key_name);
-
- struct RegOpenKey rok;
- ZERO_STRUCT(rok);
-
- rok.in.parent_key = NULL;
- rok.in.name = key_name;
- rok.in.access = REG_KEY_ALL;
-
- if(!cac_RegOpenKey(hnd, mem_ctx, &rok)) {
- fprintf(stderr, "Could not open key %s\n Error: %s\n", rok.in.name, nt_errstr(hnd->status));
- goto done;
- }
-
- printf("Creating key %s...\n", key_to_create);
-
- struct RegCreateKey rck;
- ZERO_STRUCT(rck);
-
- rck.in.parent_key = rok.out.key;
- rck.in.key_name = talloc_strdup(mem_ctx, key_to_create);
- rck.in.class_name = talloc_strdup(mem_ctx, "");
- rck.in.access = REG_KEY_ALL;
-
- if(!cac_RegCreateKey(hnd, mem_ctx, &rck)) {
- fprintf(stderr, "Could not create key. Error %s\n", nt_errstr(hnd->status));
- goto done;
- }
-
- if(!cac_RegClose(hnd, mem_ctx, rck.out.key)) {
- fprintf(stderr, "Could not close key. Error %s\n", nt_errstr(hnd->status));
- goto done;
- }
-
- /**enumerate all the subkeys*/
- printf("Enumerating all subkeys:\n");
-
- struct RegEnumKeys ek;
- ZERO_STRUCT(ek);
-
- ek.in.key = rok.out.key;
- ek.in.max_keys = 50;
-
- while(cac_RegEnumKeys(hnd, mem_ctx, &ek)) {
- int j;
-
- for(j = 0; j < ek.out.num_keys; j++) {
- printf(" Key name: %s\n", ek.out.key_names[j]);
- }
- }
-
- if(CAC_OP_FAILED(hnd->status)) {
- fprintf(stderr, "Could not enumerate keys: %s\n", nt_errstr(hnd->status));
- goto done;
- }
-
- printf("deleting key %s\n", key_to_create);
-
- struct RegDeleteKey rdk;
- ZERO_STRUCT(rdk);
-
- rdk.in.parent_key = rok.out.key;
- rdk.in.name = key_to_create;
-
- if(!cac_RegDeleteKey(hnd, mem_ctx, &rdk)) {
- fprintf(stderr, "Could not delete key. Error %s\n", nt_errstr(hnd->status));
- }
-
- printf("closing key %s...\n", key_name);
-
- if(!cac_RegClose(hnd, mem_ctx, rok.out.key)) {
- fprintf(stderr, "Could not close handle %s\n", nt_errstr(hnd->status));
- }
-
-done:
- cac_FreeHandle(hnd);
-
- talloc_destroy(mem_ctx);
-
- return 0;
-
-}
diff --git a/examples/libmsrpc/test/reg/regkeyenum.c b/examples/libmsrpc/test/reg/regkeyenum.c
deleted file mode 100644
index f140d95723..0000000000
--- a/examples/libmsrpc/test/reg/regkeyenum.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/*tests enumerating keys or values*/
-
-#include "libmsrpc.h"
-
-#define MAX_KEYS_PER_ENUM 3
-
-int main() {
- CacServerHandle *hnd = NULL;
- TALLOC_CTX *mem_ctx = NULL;
-
- int num_keys;
-
- int max_enum;
-
- int i;
-
- fstring *key_names;
-
- mem_ctx = talloc_init("regkeyenum");
-
- hnd = cac_NewServerHandle(True);
-
- printf("Enter server to connect to: ");
- fscanf(stdin, "%s", hnd->server);
-
- printf("How many keys do you want to open?: ");
- fscanf(stdin, "%d", &num_keys);
-
- printf("How many keys per enum?: ");
- fscanf(stdin, "%d", &max_enum);
-
- key_names = TALLOC_ARRAY(mem_ctx, fstring , num_keys);
- if(!key_names) {
- fprintf(stderr, "No memory\n");
- exit(-1);
- }
-
- for(i = 0; i < num_keys; i++) {
- printf("Enter key to open: ");
- fscanf(stdin, "%s", key_names[i]);
- }
-
- if(!cac_Connect(hnd, NULL)) {
- fprintf(stderr, "Could not connect to server.\n Error: %s.\n errno: %s\n", nt_errstr(hnd->status), strerror(errno));
- cac_FreeHandle(hnd);
- exit(-1);
- }
-
- for(i = 0; i < num_keys; i++) {
- printf("trying to open key %s...\n", key_names[i]);
-
- struct RegOpenKey rok;
- ZERO_STRUCT(rok);
-
- rok.in.parent_key = NULL;
- rok.in.name = key_names[i];
- rok.in.access = REG_KEY_ALL;
-
- if(!cac_RegOpenKey(hnd, mem_ctx, &rok)) {
- fprintf(stderr, "Could not open key %s\n Error: %s\n", rok.in.name, nt_errstr(hnd->status));
- continue;
- }
-
- /**enumerate all the subkeys*/
- printf("Enumerating all subkeys:\n");
-
- struct RegEnumKeys ek;
- ZERO_STRUCT(ek);
-
- ek.in.key = rok.out.key;
- ek.in.max_keys = max_enum;
-
- while(cac_RegEnumKeys(hnd, mem_ctx, &ek)) {
- int j;
-
- for(j = 0; j < ek.out.num_keys; j++) {
- printf(" Key name: %s\n", ek.out.key_names[j]);
- }
- }
-
- if(CAC_OP_FAILED(hnd->status)) {
- fprintf(stderr, "Could not enumerate keys: %s\n", nt_errstr(hnd->status));
- continue;
- }
-
- printf("closing key %s...\n", key_names[i]);
-
- if(!cac_RegClose(hnd, mem_ctx, rok.out.key)) {
- fprintf(stderr, "Could not close handle %s\n", nt_errstr(hnd->status));
- }
- }
-
- cac_FreeHandle(hnd);
-
- talloc_destroy(mem_ctx);
-
- return 0;
-
-}
diff --git a/examples/libmsrpc/test/reg/regopen.c b/examples/libmsrpc/test/reg/regopen.c
deleted file mode 100644
index fedc52e40d..0000000000
--- a/examples/libmsrpc/test/reg/regopen.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/*opens and closes a registry handle*/
-
-#include "libmsrpc.h"
-
-int main() {
- CacServerHandle *hnd = NULL;
- TALLOC_CTX *mem_ctx = NULL;
-
- POLICY_HND **keys = NULL;
-
- char roots[4][50] = { {CAC_HKCR}, {CAC_HKLM}, {CAC_HKU}, {CAC_HKPD} };
-
- int i;
-
-
- mem_ctx = talloc_init("regopen");
-
- hnd = cac_NewServerHandle(True);
-
- keys = TALLOC_ARRAY(mem_ctx, POLICY_HND *, 4);
-
- printf("Enter server to connect to: ");
- fscanf(stdin, "%s", hnd->server);
-
- if(!cac_Connect(hnd, NULL)) {
- fprintf(stderr, "Could not connect to server.\n Error: %s.\n errno: %s\n", nt_errstr(hnd->status), strerror(errno));
- cac_FreeHandle(hnd);
- exit(-1);
- }
-
- struct RegConnect rc;
- ZERO_STRUCT(rc);
-
- rc.in.access = SEC_RIGHT_MAXIMUM_ALLOWED;
-
- for(i = 0; i < 4; i++) {
- printf("opening: %s\n", roots[i]);
-
- rc.in.root = roots[i];
-
- if(!cac_RegConnect(hnd, mem_ctx, &rc)) {
- fprintf(stderr, " Could not connect to registry. %s\n", nt_errstr(hnd->status));
- continue;
- }
-
- keys[i] = rc.out.key;
- }
-
- for(i = 3; i >= 0; i--) {
- if(keys[i] == NULL)
- continue;
-
- printf("closing: %s\n", roots[i]);
-
- if(!cac_RegClose(hnd, mem_ctx, keys[i])) {
- fprintf(stderr, " Could not close handle. %s\n", nt_errstr(hnd->status));
- }
- }
-
- cac_FreeHandle(hnd);
-
- talloc_destroy(mem_ctx);
-
- return 0;
-
-}
diff --git a/examples/libmsrpc/test/reg/regopenkey.c b/examples/libmsrpc/test/reg/regopenkey.c
deleted file mode 100644
index 732da17ccf..0000000000
--- a/examples/libmsrpc/test/reg/regopenkey.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/*tests cac_RegOpenKey()*/
-
-#include "libmsrpc.h"
-
-int main() {
- CacServerHandle *hnd = NULL;
- TALLOC_CTX *mem_ctx = NULL;
-
- int num_keys;
- int i;
-
- fstring *key_names;
-
- mem_ctx = talloc_init("regopenkey");
-
- hnd = cac_NewServerHandle(True);
-
- printf("Enter server to connect to: ");
- fscanf(stdin, "%s", hnd->server);
-
- printf("How many keys do you want to open?: ");
- fscanf(stdin, "%d", &num_keys);
-
- key_names = TALLOC_ARRAY(mem_ctx, fstring , num_keys);
- if(!key_names) {
- fprintf(stderr, "No memory\n");
- exit(-1);
- }
-
- for(i = 0; i < num_keys; i++) {
- printf("Enter key to open: ");
- fscanf(stdin, "%s", key_names[i]);
- }
-
- if(!cac_Connect(hnd, NULL)) {
- fprintf(stderr, "Could not connect to server.\n Error: %s.\n errno: %s\n", nt_errstr(hnd->status), strerror(errno));
- cac_FreeHandle(hnd);
- exit(-1);
- }
-
- for(i = 0; i < num_keys; i++) {
- printf("trying to open key %s...\n", key_names[i]);
-
- struct RegOpenKey rok;
- ZERO_STRUCT(rok);
-
- rok.in.parent_key = NULL;
- rok.in.name = key_names[i];
- rok.in.access = REG_KEY_ALL;
-
- if(!cac_RegOpenKey(hnd, mem_ctx, &rok)) {
- fprintf(stderr, "Could not open key %s\n Error: %s\n", rok.in.name, nt_errstr(hnd->status));
- continue;
- }
-
- printf("closing key %s...\n", key_names[i]);
-
- if(!cac_RegClose(hnd, mem_ctx, rok.out.key)) {
- fprintf(stderr, "Could not close handle %s\n", nt_errstr(hnd->status));
- }
- }
-
- cac_FreeHandle(hnd);
-
- talloc_destroy(mem_ctx);
-
- return 0;
-
-}
diff --git a/examples/libmsrpc/test/reg/regqueryval.c b/examples/libmsrpc/test/reg/regqueryval.c
deleted file mode 100644
index 9989651898..0000000000
--- a/examples/libmsrpc/test/reg/regqueryval.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/*tests cac_RegQueryValue()*/
-
-#include "libmsrpc.h"
-#include "test_util.h"
-
-#define MAX_KEYS_PER_ENUM 3
-
-int main(int argc, char **argv) {
- CacServerHandle *hnd = NULL;
- TALLOC_CTX *mem_ctx = NULL;
-
- fstring key_name;
-
- fstring val_name;
-
- mem_ctx = talloc_init("regqueryval");
-
- hnd = cac_NewServerHandle(True);
-
- cac_SetAuthDataFn(hnd, cactest_GetAuthDataFn);
-
- cac_parse_cmd_line(argc, argv, hnd);
-
- printf("Enter key to open: ");
- fscanf(stdin, "%s", key_name);
-
- printf("Enter value to query: ");
- fscanf(stdin, "%s", val_name);
-
- if(!cac_Connect(hnd, NULL)) {
- fprintf(stderr, "Could not connect to server.\n Error: %s.\n errno: %s\n", nt_errstr(hnd->status), strerror(errno));
- cac_FreeHandle(hnd);
- exit(-1);
- }
-
- printf("trying to open key %s...\n", key_name);
-
- struct RegOpenKey rok;
- ZERO_STRUCT(rok);
-
- rok.in.parent_key = NULL;
- rok.in.name = key_name;
- rok.in.access = REG_KEY_ALL;
-
- if(!cac_RegOpenKey(hnd, mem_ctx, &rok)) {
- fprintf(stderr, "Could not open key %s\n Error: %s\n", rok.in.name, nt_errstr(hnd->status));
- goto done;
- }
-
- struct RegQueryValue rqv;
- ZERO_STRUCT(rqv);
-
- rqv.in.key = rok.out.key;
- rqv.in.val_name = talloc_strdup(mem_ctx, val_name);
-
- printf("querying value %s...\n", rqv.in.val_name);
- if(!cac_RegQueryValue(hnd, mem_ctx, &rqv)) {
- fprintf(stderr, "Could not query value. Error: %s\n", nt_errstr(hnd->status));
- }
- else {
- printf("Queried value %s\n", rqv.in.val_name);
- print_value(rqv.out.type, rqv.out.data);
- }
-
-
- printf("closing key %s...\n", key_name);
-
- if(!cac_RegClose(hnd, mem_ctx, rok.out.key)) {
- fprintf(stderr, "Could not close handle %s\n", nt_errstr(hnd->status));
- }
-
-done:
- cac_FreeHandle(hnd);
-
- talloc_destroy(mem_ctx);
-
- return 0;
-
-}
diff --git a/examples/libmsrpc/test/reg/regsetval.c b/examples/libmsrpc/test/reg/regsetval.c
deleted file mode 100644
index e7327910c2..0000000000
--- a/examples/libmsrpc/test/reg/regsetval.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*tests cac_RegSetVal()*/
-
-#include "libmsrpc.h"
-#include "test_util.h"
-
-int main(int argc, char **argv) {
- CacServerHandle *hnd = NULL;
- TALLOC_CTX *mem_ctx = NULL;
-
- fstring tmp;
-
- mem_ctx = talloc_init("regsetval");
-
- hnd = cac_NewServerHandle(True);
-
- cac_SetAuthDataFn(hnd, cactest_GetAuthDataFn);
-
- cac_parse_cmd_line(argc, argv, hnd);
-
- if(!cac_Connect(hnd, NULL)) {
- fprintf(stderr, "Could not connect to server %s. Error: %s\n", hnd->server, nt_errstr(hnd->status));
- exit(-1);
- }
-
- printf("enter key to open: \n");
- scanf("%s", tmp);
-
- struct RegOpenKey rok;
- ZERO_STRUCT(rok);
-
- rok.in.name = talloc_strdup(mem_ctx, tmp);
- rok.in.access = REG_KEY_ALL;
-
- if(!cac_RegOpenKey(hnd, mem_ctx, &rok)) {
- fprintf(stderr, "Could not open key %s. Error %s\n", rok.in.name, nt_errstr(hnd->status));
- exit(-1);
- }
-
- struct RegSetValue rsv;
- ZERO_STRUCT(rsv);
-
- rsv.in.key = rok.out.key;
-
- cactest_reg_input_val(mem_ctx, &rsv.in.type, &rsv.in.val_name, &rsv.in.value);
-
- if(!cac_RegSetValue(hnd, mem_ctx, &rsv)) {
- fprintf(stderr, "Could not set value. Error: %s\n", nt_errstr(hnd->status));
- }
-
- cac_RegClose(hnd, mem_ctx, rok.out.key);
-
- cac_FreeHandle(hnd);
-
- talloc_destroy(mem_ctx);
-
- return 0;
-}
-
-
diff --git a/examples/libmsrpc/test/reg/regvalenum.c b/examples/libmsrpc/test/reg/regvalenum.c
deleted file mode 100644
index 9778f4e2b3..0000000000
--- a/examples/libmsrpc/test/reg/regvalenum.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/*tests enumerating registry values*/
-
-#include "libmsrpc.h"
-#include "test_util.h"
-
-#define MAX_KEYS_PER_ENUM 3
-
-
-int main(int argc, char **argv) {
- CacServerHandle *hnd = NULL;
- TALLOC_CTX *mem_ctx = NULL;
-
- int num_keys;
-
- int max_enum;
-
- fstring *key_names;
-
- int i;
-
- mem_ctx = talloc_init("regvalenum");
-
- hnd = cac_NewServerHandle(True);
-
- cac_parse_cmd_line(argc, argv, hnd);
-
- cac_SetAuthDataFn(hnd, cactest_GetAuthDataFn);
-
- if(!cac_Connect(hnd, NULL)) {
- fprintf(stderr, "Could not connect to server.\n Error: %s.\n errno: %s\n", nt_errstr(hnd->status), strerror(errno));
- cac_FreeHandle(hnd);
- exit(-1);
- }
-
- printf("How many keys do you want to open?: ");
- fscanf(stdin, "%d", &num_keys);
-
- printf("How many values per enum?: ");
- fscanf(stdin, "%d", &max_enum);
-
- key_names = TALLOC_ARRAY(mem_ctx, fstring , num_keys);
- if(!key_names) {
- fprintf(stderr, "No memory\n");
- exit(-1);
- }
-
- for(i = 0; i < num_keys; i++) {
- printf("Enter key to open: ");
- fscanf(stdin, "%s", key_names[i]);
- }
-
- for(i = 0; i < num_keys; i++) {
- printf("trying to open key %s...\n", key_names[i]);
-
- struct RegOpenKey rok;
- ZERO_STRUCT(rok);
-
- rok.in.parent_key = NULL;
- rok.in.name = key_names[i];
- rok.in.access = REG_KEY_ALL;
-
- if(!cac_RegOpenKey(hnd, mem_ctx, &rok)) {
- fprintf(stderr, "Could not open key %s\n Error: %s\n", rok.in.name, nt_errstr(hnd->status));
- continue;
- }
-
- /**enumerate all the subkeys*/
- printf("Enumerating all values:\n");
-
- struct RegEnumValues rev;
- ZERO_STRUCT(rev);
-
- rev.in.key = rok.out.key;
- rev.in.max_values = max_enum;
-
- while(cac_RegEnumValues(hnd, mem_ctx, &rev)) {
- int j;
-
- for(j = 0; j < rev.out.num_values; j++) {
- printf(" Value name: %s\n", rev.out.value_names[j]);
- print_value(rev.out.types[j], rev.out.values[j]);
- }
- }
-
- if(CAC_OP_FAILED(hnd->status)) {
- fprintf(stderr, "Could not enumerate values: %s\n", nt_errstr(hnd->status));
- continue;
- }
-
- printf("closing key %s...\n", key_names[i]);
-
- if(!cac_RegClose(hnd, mem_ctx, rok.out.key)) {
- fprintf(stderr, "Could not close handle %s\n", nt_errstr(hnd->status));
- }
- }
-
- cac_FreeHandle(hnd);
-
- talloc_destroy(mem_ctx);
-
- return 0;
-
-}
diff --git a/examples/libmsrpc/test/reg/security.c b/examples/libmsrpc/test/reg/security.c
deleted file mode 100644
index 6808f8c1f3..0000000000
--- a/examples/libmsrpc/test/reg/security.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/*tests cac_RegSetKeySecurity()*/
-
-#include "libmsrpc.h"
-#include "test_util.h"
-
-int main(int argc, char **argv) {
- CacServerHandle *hnd = NULL;
- TALLOC_CTX *mem_ctx = NULL;
-
- fstring tmp;
-
- mem_ctx = talloc_init("regsetval");
-
- hnd = cac_NewServerHandle(True);
-
- cac_SetAuthDataFn(hnd, cactest_GetAuthDataFn);
-
- cac_parse_cmd_line(argc, argv, hnd);
-
- if(!cac_Connect(hnd, NULL)) {
- fprintf(stderr, "Could not connect to server %s. Error: %s\n", hnd->server, nt_errstr(hnd->status));
- exit(-1);
- }
-
- struct RegOpenKey rok;
- ZERO_STRUCT(rok);
-
- printf("enter key to query: ");
- cactest_readline(stdin, tmp);
-
- rok.in.name = talloc_strdup(mem_ctx, tmp);
- rok.in.access = REG_KEY_ALL;
-
- if(!cac_RegOpenKey(hnd, mem_ctx, &rok)) {
- fprintf(stderr, "Could not open key %s. Error %s\n", rok.in.name, nt_errstr(hnd->status));
- exit(-1);
- }
-
- struct RegGetKeySecurity rks;
- ZERO_STRUCT(rks);
-
- rks.in.key = rok.out.key;
- rks.in.info_type = ALL_SECURITY_INFORMATION;
-
- if(!cac_RegGetKeySecurity(hnd, mem_ctx, &rks)) {
- fprintf(stderr, "Could not query security for %s. Error: %s\n", rok.in.name, nt_errstr(hnd->status));
- goto done;
- }
-
- printf("resetting key security...\n");
-
- struct RegSetKeySecurity rss;
- ZERO_STRUCT(rss);
-
- rss.in.key = rok.out.key;
- rss.in.info_type = ALL_SECURITY_INFORMATION;
- rss.in.size = rks.out.size;
- rss.in.descriptor = rks.out.descriptor;
-
- if(!cac_RegSetKeySecurity(hnd, mem_ctx, &rss)) {
- fprintf(stderr, "Could not set security. Error %s\n", nt_errstr(hnd->status));
- }
-
-done:
- cac_RegClose(hnd, mem_ctx, rok.out.key);
-
- cac_FreeHandle(hnd);
-
- talloc_destroy(mem_ctx);
-
- return 0;
-}
-
-
diff --git a/examples/libmsrpc/test/reg/shutdown.c b/examples/libmsrpc/test/reg/shutdown.c
deleted file mode 100644
index 6184fbd976..0000000000
--- a/examples/libmsrpc/test/reg/shutdown.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/*tries to shut down a remote pc*/
-
-#include "libmsrpc.h"
-#include "test_util.h"
-
-
-int main(int argc, char **argv) {
- CacServerHandle *hnd = NULL;
- TALLOC_CTX *mem_ctx = NULL;
-
- fstring tmp;
-
- mem_ctx = talloc_init("cac_shutdown");
-
- hnd = cac_NewServerHandle(True);
-
- cac_SetAuthDataFn(hnd, cactest_GetAuthDataFn);
-
- cac_parse_cmd_line(argc, argv, hnd);
-
- hnd->_internal.srv_level = SRV_WIN_NT4;
-
- if(!cac_Connect(hnd, NULL)) {
- fprintf(stderr, "Could not connect to server %s. Error: %s\n", hnd->server, nt_errstr(hnd->status));
- exit(-1);
- }
-
- struct Shutdown s;
- ZERO_STRUCT(s);
-
- printf("Message: ");
- cactest_readline(stdin, tmp);
-
- s.in.message = talloc_strdup(mem_ctx, tmp);
-
- printf("timeout: ");
- scanf("%d", &s.in.timeout);
-
- printf("Reboot? [y/n]: ");
- cactest_readline(stdin, tmp);
-
- s.in.reboot = ( tmp[0] == 'y') ? True : False;
-
- printf("Force? [y/n]: ");
- cactest_readline(stdin, tmp);
-
- s.in.force = (tmp[0] == 'y') ? True : False;
-
- if(!cac_Shutdown(hnd, mem_ctx, &s)) {
- fprintf(stderr, "could not shut down server: error %s\n", nt_errstr(hnd->status));
- goto done;
- }
-
- printf("Server %s is shutting down. Would you like to try to abort? [y/n]: ", hnd->server);
- fscanf(stdin, "%s", tmp);
-
- if(tmp[0] == 'y') {
- if(!cac_AbortShutdown(hnd, mem_ctx)) {
- fprintf(stderr, "Could not abort shutdown. Error %s\n", nt_errstr(hnd->status));
- }
- }
-
-done:
- cac_FreeHandle(hnd);
- talloc_destroy(mem_ctx);
-
- return 0;
-}