diff options
author | Luke Leighton <lkcl@samba.org> | 1999-11-26 23:04:19 +0000 |
---|---|---|
committer | Luke Leighton <lkcl@samba.org> | 1999-11-26 23:04:19 +0000 |
commit | 9b683054751866af4fb2ac79c092392e31effaff (patch) | |
tree | e9648db6efbff69ff731c1df466f59fd21cc853e /source3/rpc_client | |
parent | 5e3bc7875656362770b0c9a2a45d2f83c985c6e5 (diff) | |
download | samba-9b683054751866af4fb2ac79c092392e31effaff.tar.gz samba-9b683054751866af4fb2ac79c092392e31effaff.tar.bz2 samba-9b683054751866af4fb2ac79c092392e31effaff.zip |
whoa. _major_ restructure of rpcclient. fixed some buuugs, created a few.
found out that getopt() _must_ have optind set to 0 before reuse.
still haven't decided what to do with the net* api yet...
(This used to be commit 29c480085e786905bfd92ea3cd93658f94e96e47)
Diffstat (limited to 'source3/rpc_client')
-rw-r--r-- | source3/rpc_client/cli_atsvc.c | 13 | ||||
-rw-r--r-- | source3/rpc_client/cli_samr.c | 1 | ||||
-rw-r--r-- | source3/rpc_client/msrpc_samr.c | 42 |
3 files changed, 50 insertions, 6 deletions
diff --git a/source3/rpc_client/cli_atsvc.c b/source3/rpc_client/cli_atsvc.c index bebc4d0bc7..ba18a36313 100644 --- a/source3/rpc_client/cli_atsvc.c +++ b/source3/rpc_client/cli_atsvc.c @@ -128,7 +128,7 @@ enumerate scheduled jobs ****************************************************************************/ BOOL at_enum_jobs(struct cli_state *cli, uint16 fnum, char *server_name, uint32 *num_jobs, - AT_ENUM_INFO *jobs, fstring *commands) + AT_ENUM_INFO *jobs, char ***commands) { prs_struct rbuf; prs_struct buf; @@ -167,13 +167,18 @@ BOOL at_enum_jobs(struct cli_state *cli, uint16 fnum, { int i; - *num_jobs = r_e.num_entries; + *num_jobs = 0; memcpy(jobs, &r_e.info, r_e.num_entries * sizeof(AT_ENUM_INFO)); for (i = 0; i < r_e.num_entries; i++) { - unistr2_to_ascii(commands[i], &r_e.command[i], - sizeof(commands[i])); + fstring cmd; + unistr2_to_ascii(cmd, &r_e.command[i], sizeof(cmd)); + add_chars_to_array(num_jobs, commands, cmd); + } + if ((*num_jobs) != r_e.num_entries) + { + p = False; } } } diff --git a/source3/rpc_client/cli_samr.c b/source3/rpc_client/cli_samr.c index 44425b5358..86f78d1816 100644 --- a/source3/rpc_client/cli_samr.c +++ b/source3/rpc_client/cli_samr.c @@ -2444,6 +2444,7 @@ BOOL samr_query_dispinfo( POLICY_HND *pol_domain, uint16 level, if (p && r_o.ptr_entries != 0) { valid_query = True; + (*num_entries) = r_o.num_entries; } } diff --git a/source3/rpc_client/msrpc_samr.c b/source3/rpc_client/msrpc_samr.c index 8dd5201bb1..d72e57308c 100644 --- a/source3/rpc_client/msrpc_samr.c +++ b/source3/rpc_client/msrpc_samr.c @@ -1388,12 +1388,50 @@ BOOL msrpc_sam_create_dom_user(const char* srv_name, DOM_SID *sid1, if (res2) { - DEBUG(5,("cmd_sam_create_dom_user: succeeded\n")); + DEBUG(5,("msrpc_sam_create_dom_user: succeeded\n")); } else { - DEBUG(5,("cmd_sam_create_dom_user: failed\n")); + DEBUG(5,("msrpc_sam_create_dom_user: failed\n")); } return res2; } + +/**************************************************************************** +experimental SAM query display info. +****************************************************************************/ +BOOL msrpc_sam_query_dispinfo(const char* srv_name, const char* domain, + DOM_SID *sid1, + uint16 switch_value, + uint32 *num_entries, SAM_DISPINFO_CTR *ctr, + DISP_FN(disp_fn)) +{ + BOOL res = True; + BOOL res1 = True; + uint32 ace_perms = 0x304; /* absolutely no idea. */ + POLICY_HND sam_pol; + POLICY_HND pol_dom; + + /* establish a connection. */ + res = res ? samr_connect( srv_name, 0x02000000, &sam_pol) : False; + + /* connect to the domain */ + res = res ? samr_open_domain( &sam_pol, ace_perms, sid1, + &pol_dom) : False; + + /* send a samr query_disp_info command */ + res1 = res ? samr_query_dispinfo( &pol_dom, switch_value, + num_entries, ctr) : False; + + res = res ? samr_close(&sam_pol) : False; + res = res ? samr_close(&pol_dom) : False; + + if (res1 && disp_fn != NULL) + { + disp_fn(domain, sid1, switch_value, *num_entries, ctr); + } + + return res1; +} + |