diff options
author | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 15:34:30 -0500 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 15:34:30 -0500 |
commit | e5a951325a6cac8567af3a66de6d2df577508ae4 (patch) | |
tree | 34da9fe59f3c2d7f8edb072144443a9704197831 /examples/libmsrpc/test/lsa/lsapol.c | |
parent | 57482469b32645250e92a7ffd003aeeb4a42235e (diff) | |
download | samba-e5a951325a6cac8567af3a66de6d2df577508ae4.tar.gz |
[GLUE] Rsync SAMBA_3_2_0 SVN r25598 in order to create the v3-2-test branch.
(This used to be commit 5c6c8e1fe93f340005110a7833946191659d88ab)
Diffstat (limited to 'examples/libmsrpc/test/lsa/lsapol.c')
-rw-r--r-- | examples/libmsrpc/test/lsa/lsapol.c | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/examples/libmsrpc/test/lsa/lsapol.c b/examples/libmsrpc/test/lsa/lsapol.c deleted file mode 100644 index 58407e4343b..00000000000 --- a/examples/libmsrpc/test/lsa/lsapol.c +++ /dev/null @@ -1,87 +0,0 @@ -/* simple test code, opens and closes an LSA policy handle using libmsrpc, careful.. there's no password input masking*/ - -#include "includes.h" -#include "libmsrpc.h" - -void fill_conn_info(CacServerHandle *hnd) { - pstring domain; - pstring username; - pstring password; - pstring server; - - fprintf(stdout, "Enter domain name: "); - fscanf(stdin, "%s", domain); - - fprintf(stdout, "Enter username: "); - fscanf(stdin, "%s", username); - - fprintf(stdout, "Enter password (no input masking): "); - fscanf(stdin, "%s", password); - - fprintf(stdout, "Enter server (ip or name): "); - fscanf(stdin, "%s", server); - - hnd->domain = SMB_STRDUP(domain); - hnd->username = SMB_STRDUP(username); - hnd->password = SMB_STRDUP(password); - hnd->server = SMB_STRDUP(server); -} - -int main() { - CacServerHandle *hnd = NULL; - TALLOC_CTX *mem_ctx; - struct LsaOpenPolicy op; - - mem_ctx = talloc_init("lsapol"); - - - hnd = cac_NewServerHandle(False); - - /*this line is unnecesary*/ - cac_SetAuthDataFn(hnd, cac_GetAuthDataFn); - - hnd->debug = 0; - - fill_conn_info(hnd); - - /*connect to the server, its name/ip is already in the handle so just pass NULL*/ - if(!cac_Connect(hnd, NULL)) { - fprintf(stderr, "Could not connect to server. \n Error %s\n errno(%d): %s\n", nt_errstr(hnd->status), errno, strerror(errno)); - cac_FreeHandle(hnd); - exit(-1); - } - else { - fprintf(stdout, "Connected to server\n"); - } - - op.in.access = GENERIC_EXECUTE_ACCESS; - op.in.security_qos = True; - - /*open the handle*/ - if(!cac_LsaOpenPolicy(hnd, mem_ctx, &op)) { - fprintf(stderr, "Could not open policy.\n Error: %s.errno: %d.\n", nt_errstr(hnd->status), errno); - cac_FreeHandle(hnd); - exit(-1); - } - else { - fprintf(stdout, "Opened Policy handle\n"); - } - - /*close the handle*/ - if(!cac_LsaClosePolicy(hnd, mem_ctx, op.out.pol)) { - fprintf(stderr, "Could not close policy. Error: %s\n", nt_errstr(hnd->status)); - } - else { - fprintf(stdout, "Closed Policy handle\n"); - } - - /*cleanup*/ - cac_FreeHandle(hnd); - - talloc_destroy(mem_ctx); - - fprintf(stdout, "Free'd server handle\n"); - - return 0; -} - |