From 8308c000b2022769644ed8ea1fc772776257c99b Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 8 Dec 1998 00:25:04 +0000 Subject: adding srvsvc pipe. (This used to be commit d06d6369942828ec89e90f99bd0d0d3f91d61d13) --- source3/Makefile.in | 4 +- source3/include/ntdomain.h | 1 + source3/include/proto.h | 56 ++++++++++++++-- source3/include/rpc_samr.h | 19 +++++- source3/include/rpc_svcctl.h | 71 ++++++++++++++++++++ source3/include/smb.h | 1 + source3/rpc_client/cli_lsarpc.c | 2 +- source3/rpc_parse/parse_rpc.c | 11 ++++ source3/rpc_parse/parse_samr.c | 65 +++++++++++++++++++ source3/rpc_parse/parse_svc.c | 136 ++++++++++++++++++++++++++++++++++++++ source3/rpc_server/srv_pipe.c | 1 + source3/rpc_server/srv_samr.c | 18 +++++- source3/rpc_server/srv_svcctl.c | 140 ++++++++++++++++++++++++++++++++++++++++ source3/rpcclient/cmd_lsarpc.c | 4 +- source3/smbd/nttrans.c | 1 + 15 files changed, 519 insertions(+), 11 deletions(-) create mode 100644 source3/include/rpc_svcctl.h create mode 100644 source3/rpc_parse/parse_svc.c create mode 100644 source3/rpc_server/srv_svcctl.c (limited to 'source3') diff --git a/source3/Makefile.in b/source3/Makefile.in index d353ed9ea5..837e7fcf8a 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -126,6 +126,7 @@ RPC_SERVER_OBJ = \ rpc_server/srv_reg.o \ rpc_server/srv_samr.o \ rpc_server/srv_srvsvc.o \ + rpc_server/srv_svcctl.o \ rpc_server/srv_pipe.o \ rpc_server/srv_lookup.o \ rpc_server/srv_wkssvc.o @@ -134,7 +135,8 @@ RPC_PARSE_OBJ = rpc_parse/parse_lsa.o rpc_parse/parse_misc.o \ rpc_parse/parse_net.o rpc_parse/parse_prs.o \ rpc_parse/parse_reg.o rpc_parse/parse_rpc.o \ rpc_parse/parse_samr.o rpc_parse/parse_srv.o \ - rpc_parse/parse_wks.o rpc_parse/parse_sec.o + rpc_parse/parse_wks.o rpc_parse/parse_sec.o \ + rpc_parse/parse_svc.o RPC_CLIENT_OBJ = \ rpc_client/cli_login.o \ diff --git a/source3/include/ntdomain.h b/source3/include/ntdomain.h index d03b1e0a3e..75b9ae8629 100644 --- a/source3/include/ntdomain.h +++ b/source3/include/ntdomain.h @@ -40,6 +40,7 @@ #include "rpc_reg.h" #include "rpc_samr.h" #include "rpc_srvsvc.h" +#include "rpc_svcctl.h" #include "rpc_wkssvc.h" /* diff --git a/source3/include/proto.h b/source3/include/proto.h index 7f170aaad5..f237c08999 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -47,6 +47,10 @@ BOOL make_alias_line(char *p, int max_len, struct aliasdb_ops *file_initialise_alias_db(void); +/*The following definitions come from groupdb/aliasldap.c */ + +struct aliasdb_ops *ldap_initialise_alias_db(void); + /*The following definitions come from groupdb/aliasunix.c */ BOOL get_unixalias_members(struct group *grp, @@ -78,6 +82,10 @@ BOOL make_builtin_line(char *p, int max_len, LOCAL_GRP *blt, LOCAL_GRP_MEMBER **mem, int *num_mem); +/*The following definitions come from groupdb/builtinldap.c */ + +struct aliasdb_ops *ldap_initialise_builtin_db(void); + /*The following definitions come from groupdb/builtinunix.c */ BOOL get_unixbuiltin_members(struct group *grp, @@ -114,6 +122,10 @@ BOOL make_group_line(char *p, int max_len, struct groupdb_ops *file_initialise_group_db(void); +/*The following definitions come from groupdb/groupldap.c */ + +struct groupdb_ops *ldap_initialise_group_db(void); + /*The following definitions come from groupdb/groupunix.c */ BOOL get_unixgroup_members(struct group *grp, @@ -1174,9 +1186,8 @@ char *lp_driverfile(void); char *lp_panic_action(void); char *lp_ldap_server(void); char *lp_ldap_suffix(void); -char *lp_ldap_filter(void); -char *lp_ldap_root(void); -char *lp_ldap_rootpasswd(void); +char *lp_ldap_bind_as(void); +char *lp_ldap_passwd_file(void); int lp_ssl_version(void); char *lp_ssl_hosts(void); char *lp_ssl_hosts_resign(void); @@ -1361,7 +1372,14 @@ BOOL pm_process( char *FileName, /*The following definitions come from passdb/ldap.c */ -struct passdb_ops *ldap_initialise_password_db(void); +BOOL ldap_open_connection(BOOL modify); +void ldap_close_connection(); +BOOL ldap_search_for(char *filter); +BOOL ldap_search_by_name(const char *user); +BOOL ldap_search_by_uid(int uid); +BOOL ldap_get_attribute(char *attribute, char *value); +struct smb_passwd *ldap_getpw(); +struct smb_passdb_ops *ldap_initialise_password_db(void); /*The following definitions come from passdb/nispass.c */ @@ -1417,6 +1435,10 @@ struct smb_passwd *getsmbgrpuid(uid_t unix_uid, uint32 **grps, int *num_grps, uint32 **alss, int *num_alss); +/*The following definitions come from passdb/passgrpldap.c */ + +struct passgrp_ops *ldap_initialise_password_grp(void); + /*The following definitions come from passdb/sampass.c */ void *startsamfilepwent(BOOL update); @@ -1443,6 +1465,12 @@ struct smb_passwd *pwdb_sam_to_smb(struct sam_passwd *user); struct sam_passwd *pwdb_smb_to_sam(struct smb_passwd *user); struct sam_passwd *pwdb_sam_map_names(struct sam_passwd *sam); +/*The following definitions come from passdb/sampassldap.c */ + +BOOL ldap_search_by_rid(uint32 rid); +BOOL ldap_search_by_ntname(const char *ntname); +struct sam_passdb_ops *ldap_initialise_sam_password_db(void); + /*The following definitions come from passdb/smbpass.c */ struct smb_passdb_ops *file_initialise_password_db(void); @@ -2105,6 +2133,10 @@ void samr_io_q_unknown_3(char *desc, SAMR_Q_UNKNOWN_3 *q_u, prs_struct *ps, int void make_samr_q_query_dom_info(SAMR_Q_QUERY_DOMAIN_INFO *q_u, POLICY_HND *domain_pol, uint16 switch_value); void samr_io_q_query_dom_info(char *desc, SAMR_Q_QUERY_DOMAIN_INFO *q_u, prs_struct *ps, int depth); +void make_unk_info6(SAM_UNK_INFO_6 *u_6); +void sam_io_unk_info6(char *desc, SAM_UNK_INFO_6 *u_6, prs_struct *ps, int depth); +void make_unk_info7(SAM_UNK_INFO_7 *u_7); +void sam_io_unk_info7(char *desc, SAM_UNK_INFO_7 *u_7, prs_struct *ps, int depth); void make_unk_info2(SAM_UNK_INFO_2 *u_2, char *domain, char *server); void sam_io_unk_info2(char *desc, SAM_UNK_INFO_2 *u_2, prs_struct *ps, int depth); void make_samr_r_query_dom_info(SAMR_R_QUERY_DOMAIN_INFO *r_u, @@ -2448,6 +2480,18 @@ void make_time_of_day_info(TIME_OF_DAY_INFO *tod, uint32 elapsedt, uint32 msecs, uint32 month, uint32 year, uint32 weekday); void srv_io_r_net_remote_tod(char *desc, SRV_R_NET_REMOTE_TOD *r_n, prs_struct *ps, int depth); +/*The following definitions come from rpc_parse/parse_svc.c */ + +void make_svc_q_open_policy(SVC_Q_OPEN_POLICY *q_u, + char *server, uint16 unknown) ; +void svc_io_q_open_policy(char *desc, SVC_Q_OPEN_POLICY *q_u, prs_struct *ps, int depth); +void make_svc_r_open_policy(SVC_R_OPEN_POLICY *r_u, POLICY_HND *hnd, + uint32 status) ; +void svc_io_r_open_policy(char *desc, SVC_R_OPEN_POLICY *r_u, prs_struct *ps, int depth); +void make_svc_q_close(SVC_Q_CLOSE *q_c, POLICY_HND *hnd); +void svc_io_q_close(char *desc, SVC_Q_CLOSE *q_u, prs_struct *ps, int depth); +void svc_io_r_close(char *desc, SVC_R_CLOSE *r_u, prs_struct *ps, int depth); + /*The following definitions come from rpc_parse/parse_wks.c */ void make_wks_q_query_info(WKS_Q_QUERY_INFO *q_u, @@ -2538,6 +2582,10 @@ BOOL api_samr_rpc(pipes_struct *p, prs_struct *data); BOOL api_srvsvc_rpc(pipes_struct *p, prs_struct *data); +/*The following definitions come from rpc_server/srv_svcctl.c */ + +BOOL api_svcctl_rpc(pipes_struct *p, prs_struct *data); + /*The following definitions come from rpc_server/srv_wkssvc.c */ BOOL api_wkssvc_rpc(pipes_struct *p, prs_struct *data); diff --git a/source3/include/rpc_samr.h b/source3/include/rpc_samr.h index bfa0218fd3..07ae0301d4 100644 --- a/source3/include/rpc_samr.h +++ b/source3/include/rpc_samr.h @@ -373,7 +373,22 @@ typedef struct q_samr_query_domain_info } SAMR_Q_QUERY_DOMAIN_INFO; -typedef struct sam_unkown_info_2_info +typedef struct sam_unknown_info_6_info +{ + uint32 unknown_0; /* 0x0000 0000 */ + + uint32 ptr_0; /* pointer to unknown structure */ + uint8 padding[12]; /* 12 bytes zeros */ + +} SAM_UNK_INFO_6; + +typedef struct sam_unknown_info_7_info +{ + uint16 unknown_0; /* 0x0003 */ + +} SAM_UNK_INFO_7; + +typedef struct sam_unknown_info_2_info { uint32 unknown_0; /* 0x0000 0000 */ uint32 unknown_1; /* 0x8000 0000 */ @@ -410,6 +425,8 @@ typedef struct sam_unknown_ctr_info union { SAM_UNK_INFO_2 inf2; + SAM_UNK_INFO_6 inf6; + SAM_UNK_INFO_7 inf7; } info; diff --git a/source3/include/rpc_svcctl.h b/source3/include/rpc_svcctl.h new file mode 100644 index 0000000000..0a98496c79 --- /dev/null +++ b/source3/include/rpc_svcctl.h @@ -0,0 +1,71 @@ +/* + Unix SMB/Netbios implementation. + Version 1.9. + SMB parameters and setup + Copyright (C) Andrew Tridgell 1992-1997 + Copyright (C) Luke Kenneth Casson Leighton 1996-1997 + Copyright (C) Paul Ashton 1997 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _RPC_SVCCTL_H /* _RPC_SVCCTL_H */ +#define _RPC_SVCCTL_H + + +/* svcctl pipe */ +#define SVC_OPEN_POLICY 0x0f +#define SVC_CLOSE 0x00 + + +/* SVC_Q_OPEN_POLICY */ +typedef struct q_svc_open_pol_info +{ + uint32 ptr_srv_name; /* pointer (to server name?) */ + UNISTR2 uni_srv_name; /* unicode server name starting with '\\' */ + + uint32 unknown; /* unknown */ + +} SVC_Q_OPEN_POLICY; + +/* SVC_R_OPEN_POLICY */ +typedef struct r_svc_open_pol_info +{ + POLICY_HND pol; + uint32 status; /* return status */ + +} SVC_R_OPEN_POLICY; + + +/* SVC_Q_CLOSE */ +typedef struct q_svc_close_info +{ + POLICY_HND pol; + +} SVC_Q_CLOSE; + + + +/* SVC_R_CLOSE */ +typedef struct r_svc_close_info +{ + POLICY_HND pol; + uint32 status; /* return status */ + +} SVC_R_CLOSE; + + +#endif /* _RPC_SVCCTL_H */ + diff --git a/source3/include/smb.h b/source3/include/smb.h index 1ed4ea7089..9c699fc423 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -326,6 +326,7 @@ typedef char fstring[128]; #define PIPE_WINREG "\\PIPE\\winreg" #define PIPE_WKSSVC "\\PIPE\\wkssvc" #define PIPE_NETLOGON "\\PIPE\\NETLOGON" +#define PIPE_SVCCTL "\\PIPE\\SVCCTL" #define PIPE_NTLSA "\\PIPE\\ntlsa" #define PIPE_NTSVCS "\\PIPE\\ntsvcs" #define PIPE_LSASS "\\PIPE\\lsass" diff --git a/source3/rpc_client/cli_lsarpc.c b/source3/rpc_client/cli_lsarpc.c index 81bff830dd..0e28174b8b 100644 --- a/source3/rpc_client/cli_lsarpc.c +++ b/source3/rpc_client/cli_lsarpc.c @@ -199,7 +199,7 @@ BOOL lsa_lookup_names(struct cli_state *cli, uint16 fnum, sid_copy(sid, &ref.ref_dom[dom_idx].ref_dom.sid); if (dom_rid != 0xffffffff) { - sid_append_rid(sid, dom_rid); + sid_append_rid(sid, dom_rid); } } else diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 5059ca222b..9ce83bea83 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -42,6 +42,16 @@ interface/version dce/rpc pipe identification }, 0x02 \ } \ +#define SYNT_SVCCTL_V2 \ +{ \ + { \ + 0x81, 0xbb, 0x7a, 0x36, \ + 0x44, 0x98, 0xf1, 0x35, \ + 0xad, 0x32, 0x98, 0xf0, \ + 0x38, 0x00, 0x10, 0x03 \ + }, 0x02 \ +} \ + #define SYNT_NETLOGON_V2 \ { \ { \ @@ -129,6 +139,7 @@ struct pipe_id_info pipe_names [] = { PIPE_SAMR , SYNT_SAMR_V1 , PIPE_LSASS , TRANS_SYNT_V2 }, { PIPE_NETLOGON, SYNT_NETLOGON_V1, PIPE_LSASS , TRANS_SYNT_V2 }, { PIPE_SRVSVC , SYNT_SRVSVC_V3 , PIPE_NTSVCS , TRANS_SYNT_V2 }, + { PIPE_SVCCTL , SYNT_SVCCTL_V2 , PIPE_NTSVCS , TRANS_SYNT_V2 }, { PIPE_WKSSVC , SYNT_WKSSVC_V1 , PIPE_NTSVCS , TRANS_SYNT_V2 }, { PIPE_WINREG , SYNT_WINREG_V1 , PIPE_WINREG , TRANS_SYNT_V2 }, { NULL , SYNT_NONE_V0 , NULL , SYNT_NONE_V0 } diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 52bcb4ff77..f4c1790254 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -258,6 +258,61 @@ void samr_io_q_query_dom_info(char *desc, SAMR_Q_QUERY_DOMAIN_INFO *q_u, prs_st prs_align(ps); } +/******************************************************************* +makes a structure. +********************************************************************/ +void make_unk_info6(SAM_UNK_INFO_6 *u_6) +{ + if (u_6 == NULL) return; + + u_6->unknown_0 = 0x00000000; + u_6->ptr_0 = 1; + memset(u_6->padding, 0, sizeof(u_6->padding)); /* 12 bytes zeros */ +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void sam_io_unk_info6(char *desc, SAM_UNK_INFO_6 *u_6, prs_struct *ps, int depth) +{ + if (u_6 == NULL) return; + + prs_debug(ps, depth, desc, "sam_io_unk_info6"); + depth++; + + prs_uint32("unknown_0", ps, depth, &u_6->unknown_0); /* 0x0000 0000 */ + prs_uint32("ptr_0", ps, depth, &u_6->ptr_0); /* pointer to unknown structure */ + prs_uint8s(False, "padding", ps, depth, u_6->padding, sizeof(u_6->padding)); /* 12 bytes zeros */ + + prs_align(ps); + +} + +/******************************************************************* +makes a structure. +********************************************************************/ +void make_unk_info7(SAM_UNK_INFO_7 *u_7) +{ + if (u_7 == NULL) return; + + u_7->unknown_0 = 0x0003; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void sam_io_unk_info7(char *desc, SAM_UNK_INFO_7 *u_7, prs_struct *ps, int depth) +{ + if (u_7 == NULL) return; + + prs_debug(ps, depth, desc, "sam_io_unk_info7"); + depth++; + + prs_uint16("unknown_0", ps, depth, &u_7->unknown_0); /* 0x0003 */ + prs_align(ps); + +} + /******************************************************************* makes a structure. ********************************************************************/ @@ -376,6 +431,16 @@ void samr_io_r_query_dom_info(char *desc, SAMR_R_QUERY_DOMAIN_INFO *r_u, prs_str { switch (r_u->switch_value) { + case 0x06: + { + sam_io_unk_info6("unk_inf6", &r_u->ctr->info.inf6, ps, depth); + break; + } + case 0x07: + { + sam_io_unk_info7("unk_inf7", &r_u->ctr->info.inf7, ps, depth); + break; + } case 0x02: { sam_io_unk_info2("unk_inf2", &r_u->ctr->info.inf2, ps, depth); diff --git a/source3/rpc_parse/parse_svc.c b/source3/rpc_parse/parse_svc.c new file mode 100644 index 0000000000..288f23f46b --- /dev/null +++ b/source3/rpc_parse/parse_svc.c @@ -0,0 +1,136 @@ + +/* + * Unix SMB/Netbios implementation. + * Version 1.9. + * RPC Pipe client / server routines + * Copyright (C) Andrew Tridgell 1992-1997, + * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, + * Copyright (C) Paul Ashton 1997. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include "includes.h" + +extern int DEBUGLEVEL; + +/******************************************************************* + make_svc_q_open_policy + ********************************************************************/ +void make_svc_q_open_policy(SVC_Q_OPEN_POLICY *q_u, + char *server, uint16 unknown) +{ + DEBUG(5,("make_svc_q_open_policy\n")); + + make_buf_unistr2(&(q_u->uni_srv_name), &(q_u->ptr_srv_name), server); + q_u->unknown = unknown; + +} + +/******************************************************************* +reads or writes a SVC_Q_OPEN_POLICY structure. +********************************************************************/ +void svc_io_q_open_policy(char *desc, SVC_Q_OPEN_POLICY *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return; + + prs_debug(ps, depth, desc, "svc_io_q_open_policy"); + depth++; + + prs_align(ps); + + prs_uint32("ptr_srv_name", ps, depth, &(q_u->ptr_srv_name)); + smb_io_unistr2("", &(q_u->uni_srv_name), q_u->ptr_srv_name, ps, depth); + prs_align(ps); + + prs_uint32("unknown", ps, depth, &(q_u->unknown)); + prs_align(ps); +} + +/******************************************************************* + make_svc_r_open_policy + ********************************************************************/ +void make_svc_r_open_policy(SVC_R_OPEN_POLICY *r_u, POLICY_HND *hnd, + uint32 status) +{ + DEBUG(5,("make_svc_r_unknown_0: %d\n", __LINE__)); + + memcpy(&(r_u->pol), hnd, sizeof(r_u->pol)); + r_u->status = status; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void svc_io_r_open_policy(char *desc, SVC_R_OPEN_POLICY *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "svc_io_r_open_policy"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("", &(r_u->pol), ps, depth); + + prs_uint32("status ", ps, depth, &(r_u->status)); +} + +/******************************************************************* +makes an SVC_Q_CLOSE structure. +********************************************************************/ +void make_svc_q_close(SVC_Q_CLOSE *q_c, POLICY_HND *hnd) +{ + if (q_c == NULL || hnd == NULL) return; + + DEBUG(5,("make_svc_q_close\n")); + +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void svc_io_q_close(char *desc, SVC_Q_CLOSE *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) return; + + prs_debug(ps, depth, desc, "svc_io_q_close"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("", &(q_u->pol), ps, depth); + prs_align(ps); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void svc_io_r_close(char *desc, SVC_R_CLOSE *r_u, prs_struct *ps, int depth) +{ + if (r_u == NULL) return; + + prs_debug(ps, depth, desc, "svc_io_r_close"); + depth++; + + prs_align(ps); + + smb_io_pol_hnd("", &(r_u->pol), ps, depth); + prs_align(ps); + + prs_uint32("status", ps, depth, &(r_u->status)); +} + diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c index 1ad4cb6b9e..d9483deb86 100644 --- a/source3/rpc_server/srv_pipe.c +++ b/source3/rpc_server/srv_pipe.c @@ -347,6 +347,7 @@ static struct api_cmd api_fd_commands[] = { "samr", "lsass", api_samr_rpc }, { "srvsvc", "ntsvcs", api_srvsvc_rpc }, { "wkssvc", "ntsvcs", api_wkssvc_rpc }, + { "svcctl", "ntsvcs", api_svcctl_rpc }, { "NETLOGON", "lsass", api_netlog_rpc }, { "winreg", "winreg", api_reg_rpc }, { NULL, NULL, NULL } diff --git a/source3/rpc_server/srv_samr.c b/source3/rpc_server/srv_samr.c index 82dea29d9a..39a9b7591a 100644 --- a/source3/rpc_server/srv_samr.c +++ b/source3/rpc_server/srv_samr.c @@ -518,7 +518,7 @@ static void samr_reply_add_aliasmem(SAMR_Q_ADD_ALIASMEM *q_u, DEBUG(10,("add member on Domain SID\n")); become_root(True); - r_e.status = add_alias_member(alias_rid, &q_u->sid) ? 0x0 : 0xC0000000 | NT_STATUS_ACCESS_DENIED; + r_e.status = add_alias_member(alias_rid, &q_u->sid.sid) ? 0x0 : 0xC0000000 | NT_STATUS_ACCESS_DENIED; unbecome_root(True); } else if (sid_equal(&alias_sid, &global_sid_S_1_5_20)) @@ -526,7 +526,7 @@ static void samr_reply_add_aliasmem(SAMR_Q_ADD_ALIASMEM *q_u, DEBUG(10,("add member on BUILTIN SID\n")); become_root(True); - r_e.status = add_builtin_member(alias_rid, &q_u->sid) ? 0x0 : 0xC0000000 | NT_STATUS_ACCESS_DENIED; + r_e.status = add_builtin_member(alias_rid, &q_u->sid.sid) ? 0x0 : 0xC0000000 | NT_STATUS_ACCESS_DENIED; unbecome_root(True); } else @@ -2234,6 +2234,20 @@ static void samr_reply_query_dom_info(SAMR_Q_QUERY_DOMAIN_INFO *q_u, { switch (q_u->switch_value) { + case 0x06: + { + switch_value = 0x6; + make_unk_info6(&ctr.info.inf6); + + break; + } + case 0x07: + { + switch_value = 0x7; + make_unk_info7(&ctr.info.inf7); + + break; + } case 0x02: { switch_value = 0x2; diff --git a/source3/rpc_server/srv_svcctl.c b/source3/rpc_server/srv_svcctl.c new file mode 100644 index 0000000000..6ae8a5c873 --- /dev/null +++ b/source3/rpc_server/srv_svcctl.c @@ -0,0 +1,140 @@ + +/* + * Unix SMB/Netbios implementation. + * Version 1.9. + * RPC Pipe client / server routines + * Copyright (C) Andrew Tridgell 1992-1997, + * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, + * Copyright (C) Paul Ashton 1997. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include "includes.h" +#include "nterr.h" + +extern int DEBUGLEVEL; + + +/******************************************************************* + svc_reply_unknown_1 + ********************************************************************/ +static void svc_reply_close(SVC_Q_CLOSE *q_r, + prs_struct *rdata) +{ + SVC_R_CLOSE r_u; + + /* set up the REG unknown_1 response */ + bzero(r_u.pol.data, POL_HND_SIZE); + + /* close the policy handle */ + if (close_lsa_policy_hnd(&(q_r->pol))) + { + r_u.status = 0; + } + else + { + r_u.status = 0xC0000000 | NT_STATUS_OBJECT_NAME_INVALID; + } + + DEBUG(5,("svc_unknown_1: %d\n", __LINE__)); + + /* store the response in the SMB stream */ + svc_io_r_close("", &r_u, rdata, 0); + + DEBUG(5,("svc_unknown_1: %d\n", __LINE__)); +} + +/******************************************************************* + api_svc_close + ********************************************************************/ +static void api_svc_close( uint16 vuid, prs_struct *data, + prs_struct *rdata ) +{ + SVC_Q_CLOSE q_r; + svc_io_q_close("", &q_r, data, 0); + svc_reply_close(&q_r, rdata); +} + + +/******************************************************************* + svc_reply_open_policy + ********************************************************************/ +static void svc_reply_open_policy(SVC_Q_OPEN_POLICY *q_u, + prs_struct *rdata) +{ + uint32 status = 0; + POLICY_HND pol; + SVC_R_OPEN_POLICY r_u; + fstring name; + + DEBUG(5,("svc_open_policy: %d\n", __LINE__)); + + if (status == 0x0 && !open_lsa_policy_hnd(&pol)) + { + status = 0xC000000 | NT_STATUS_TOO_MANY_SECRETS; /* ha ha very droll */ + } + + fstrcpy(name, unistr2_to_str(&q_u->uni_srv_name)); + + if (status == 0x0) + { + DEBUG(5,("svc_open_policy: %s\n", name)); + /* lkcl XXXX do a check on the name, here */ + } + + if (status == 0x0 && !set_lsa_policy_reg_name(&pol, name)) + { + status = 0xC000000 | NT_STATUS_TOO_MANY_SECRETS; /* ha ha very droll */ + } + + make_svc_r_open_policy(&r_u, &pol, status); + + /* store the response in the SMB stream */ + svc_io_r_open_policy("", &r_u, rdata, 0); + + DEBUG(5,("svc_open_policy: %d\n", __LINE__)); +} + +/******************************************************************* + api_svc_open_policy + ********************************************************************/ +static void api_svc_open_policy( uint16 vuid, prs_struct *data, + prs_struct *rdata ) +{ + SVC_Q_OPEN_POLICY q_u; + svc_io_q_open_policy("", &q_u, data, 0); + svc_reply_open_policy(&q_u, rdata); +} + +/******************************************************************* + array of \PIPE\svcctl operations + ********************************************************************/ +static struct api_struct api_svc_cmds[] = +{ + { "SVC_CLOSE" , SVC_CLOSE , api_svc_close }, + { "SVC_OPEN_POLICY" , SVC_OPEN_POLICY , api_svc_open_policy }, + { NULL, 0 , NULL } +}; + +/******************************************************************* + receives a svcctl pipe and responds. + ********************************************************************/ +BOOL api_svcctl_rpc(pipes_struct *p, prs_struct *data) +{ + return api_rpcTNP(p, "api_svc_rpc", api_svc_cmds, data); +} + diff --git a/source3/rpcclient/cmd_lsarpc.c b/source3/rpcclient/cmd_lsarpc.c index cfde752901..96f952a789 100644 --- a/source3/rpcclient/cmd_lsarpc.c +++ b/source3/rpcclient/cmd_lsarpc.c @@ -131,7 +131,7 @@ void cmd_lsa_lookup_names(struct client_info *info) int i; fstring srv_name; int num_names = 0; - char *names[10]; + const char *names[10]; DOM_SID *sids; int num_sids = 0; #if 0 @@ -207,7 +207,7 @@ void cmd_lsa_lookup_names(struct client_info *info) { if (names[i] != NULL) { - free(names[i]); + free(((char **)names)[i]); } } } diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index 60620c9854..52a1005397 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -37,6 +37,7 @@ static void remove_pending_change_notify_requests_by_mid(int mid); static char *known_nt_pipes[] = { "\\LANMAN", "\\srvsvc", + "\\svcctl", "\\samr", "\\wkssvc", "\\NETLOGON", -- cgit