diff options
author | Luke Leighton <lkcl@samba.org> | 1999-01-27 20:31:58 +0000 |
---|---|---|
committer | Luke Leighton <lkcl@samba.org> | 1999-01-27 20:31:58 +0000 |
commit | 05040640856b8eb1bebc26afa2a2e210241b4838 (patch) | |
tree | 51983e9edc476b5ba7b6e8dcaad9819e2aa99277 /source3/rpcclient | |
parent | f6c646467d3b6a4ad296e50a1bf89a36ce9551bc (diff) | |
download | samba-05040640856b8eb1bebc26afa2a2e210241b4838.tar.gz samba-05040640856b8eb1bebc26afa2a2e210241b4838.tar.bz2 samba-05040640856b8eb1bebc26afa2a2e210241b4838.zip |
Service Control Manager - service enumeration.
(This used to be commit f4dd8f6b566961890b2933b7a413241bf9b93797)
Diffstat (limited to 'source3/rpcclient')
-rw-r--r-- | source3/rpcclient/cmd_svcctl.c | 51 | ||||
-rw-r--r-- | source3/rpcclient/display.c | 24 |
2 files changed, 45 insertions, 30 deletions
diff --git a/source3/rpcclient/cmd_svcctl.c b/source3/rpcclient/cmd_svcctl.c index 8ee454aaf5..162b0204b7 100644 --- a/source3/rpcclient/cmd_svcctl.c +++ b/source3/rpcclient/cmd_svcctl.c @@ -46,10 +46,13 @@ void cmd_svc_enum(struct client_info *info) BOOL res1 = True; int i; uint32 resume_hnd = 0; + uint32 buf_size = 0; + uint32 dos_error = 0; ENUM_SRVC_STATUS *svcs = NULL; + uint32 num_svcs = 0; POLICY_HND sc_man_pol; - fstring full_keyname; + fstring srv_name; fstrcpy(srv_name, "\\\\"); @@ -68,50 +71,38 @@ void cmd_svc_enum(struct client_info *info) do { + buf_size += 0x800; + /* enumerate services */ res1 = res ? do_svc_enum_svcs(smb_cli, fnum, &sc_man_pol, 0x00000030, 0x00000003, - 0x00000080, &resume_hnd, &svcs) : False; - - } while (resume_hnd != 0); + &buf_size, &resume_hnd, &dos_error, + &svcs, &num_svcs) : False; - if (svcs != NULL) - { - free(svcs); - } + } while (dos_error == ERRmoredata); -#if 0 - if (res1 && num_subkeys > 0) + if (res1 && dos_error == 0x0 && num_svcs > 0 && svcs != NULL) { - fprintf(out_hnd,"Subkeys\n"); - fprintf(out_hnd,"-------\n"); + fprintf(out_hnd,"Services\n"); + fprintf(out_hnd,"--------\n"); } - for (i = 0; i < num_subkeys; i++) + for (i = 0; i < num_svcs && svcs != NULL; i++) { - BOOL res2 = True; - /* - * enumerate key - */ - - /* enum key */ - res2 = res2 ? do_svc_enum_key(smb_cli, fnum, &key_pol, - i, enum_name, - &enum_unk1, &enum_unk2, - &key_mod_time) : False; - - if (res2) + if (res1) { - display_svc_key_info(out_hnd, ACTION_HEADER , enum_name, key_mod_time); - display_svc_key_info(out_hnd, ACTION_ENUMERATE, enum_name, key_mod_time); - display_svc_key_info(out_hnd, ACTION_FOOTER , enum_name, key_mod_time); + display_svc_info(out_hnd, ACTION_HEADER , &svcs[i]); + display_svc_info(out_hnd, ACTION_ENUMERATE, &svcs[i]); + display_svc_info(out_hnd, ACTION_FOOTER , &svcs[i]); } - } + if (svcs != NULL) + { + free(svcs); } -#endif + res = res ? do_svc_close(smb_cli, fnum, &sc_man_pol) : False; /* close the session */ diff --git a/source3/rpcclient/display.c b/source3/rpcclient/display.c index 8a5844f943..800b89e563 100644 --- a/source3/rpcclient/display.c +++ b/source3/rpcclient/display.c @@ -1535,6 +1535,30 @@ void display_reg_key_info(FILE *out_hnd, enum action_type action, } } +/**************************************************************************** + display structure + ****************************************************************************/ +void display_svc_info(FILE *out_hnd, enum action_type action, ENUM_SRVC_STATUS *svc) +{ + switch (action) + { + case ACTION_HEADER: + { + break; + } + case ACTION_ENUMERATE: + { + fprintf(out_hnd, "\t%s:", unistr2(svc->uni_srvc_name .buffer)); /* service name unicode string */ + fprintf(out_hnd, "\t%s\n", unistr2(svc->uni_disp_name .buffer)); /* display name unicode string */ + break; + } + case ACTION_FOOTER: + { + break; + } + } +} + #if COPY_THIS_TEMPLATE /**************************************************************************** display structure |