diff options
-rw-r--r-- | source3/include/proto.h | 4 | ||||
-rw-r--r-- | source3/include/rpc_samr_old.h | 18 | ||||
-rw-r--r-- | source3/rpc_parse/parse_samr.c | 6 | ||||
-rw-r--r-- | source3/rpc_server/srv_samr.c | 77 |
4 files changed, 42 insertions, 63 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h index 38afa0c222..be773f0bc3 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -2656,8 +2656,8 @@ void init_sam_user_info21(SAM_USER_INFO_21 *usr, void init_samr_r_query_userinfo(SAMR_R_QUERY_USERINFO *r_u, uint16 switch_value, void *info, uint32 status); BOOL samr_io_r_query_userinfo(char *desc, SAMR_R_QUERY_USERINFO *r_u, prs_struct *ps, int depth); -BOOL samr_io_q_unknown_32(char *desc, SAMR_Q_UNKNOWN_32 *q_u, prs_struct *ps, int depth); -BOOL samr_io_r_unknown_32(char *desc, SAMR_R_UNKNOWN_32 *r_u, prs_struct *ps, int depth); +BOOL samr_io_q_create_user(char *desc, SAMR_Q_CREATE_USER *q_u, prs_struct *ps, int depth); +BOOL samr_io_r_create_user(char *desc, SAMR_R_CREATE_USER *r_u, prs_struct *ps, int depth); void init_samr_q_connect(SAMR_Q_CONNECT *q_u, char *srv_name, uint32 unknown_0); BOOL samr_io_q_connect(char *desc, SAMR_Q_CONNECT *q_u, prs_struct *ps, int depth); diff --git a/source3/include/rpc_samr_old.h b/source3/include/rpc_samr_old.h index 29c1672425..d385f18e76 100644 --- a/source3/include/rpc_samr_old.h +++ b/source3/include/rpc_samr_old.h @@ -92,7 +92,7 @@ SamrTestPrivateFunctionsUser #define SAMR_UNKNOWN_12 0x12 #define SAMR_UNKNOWN_21 0x21 #define SAMR_UNKNOWN_2C 0x2c -#define SAMR_UNKNOWN_32 0x32 +#define SAMR_CREATE_USER 0x32 #define SAMR_UNKNOWN_34 0x34 #define SAMR_CHGPASSWD_USER 0x37 #define SAMR_UNKNOWN_38 0x38 @@ -983,10 +983,10 @@ typedef struct q_samr_unknown_21_info } SAMR_Q_UNKNOWN_21; -/* SAMR_Q_UNKNOWN_32 - probably a "create SAM entry" */ -typedef struct q_samr_unknown_32_info +/* SAMR_Q_CREATE_USER - probably a "create SAM entry" */ +typedef struct q_samr_create_user_info { - POLICY_HND pol; /* policy handle */ + POLICY_HND pol; /* policy handle */ UNIHDR hdr_mach_acct; /* unicode machine account name header */ UNISTR2 uni_mach_acct; /* unicode machine account name */ @@ -995,20 +995,20 @@ typedef struct q_samr_unknown_32_info uint16 unknown_1; /* 16 bit unknown - 0x00B0 */ uint16 unknown_2; /* 16 bit unknown - 0xe005 */ -} SAMR_Q_UNKNOWN_32; +} SAMR_Q_CREATE_USER; -/* SAMR_R_UNKNOWN_32 - probably a "create SAM entry" */ -typedef struct r_samr_unknown_32_info +/* SAMR_R_CREATE_USER - probably a "create SAM entry" */ +typedef struct r_samr_create_user_info { - POLICY_HND pol; /* policy handle */ + POLICY_HND pol; /* policy handle */ /* rid4.unknown - fail: 0030 success: 0x03ff */ DOM_RID4 rid4; /* rid and attributes */ uint32 status; /* return status - fail: 0xC000 0099: user exists */ -} SAMR_R_UNKNOWN_32; +} SAMR_R_CREATE_USER; /* SAMR_Q_OPEN_ALIAS - probably an open */ typedef struct q_samr_open_alias_info diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 58e65fa0af..72e803d22b 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -3058,12 +3058,12 @@ BOOL samr_io_r_query_userinfo(char *desc, SAMR_R_QUERY_USERINFO *r_u, prs_struc Reads or writes a structure. ********************************************************************/ -BOOL samr_io_q_unknown_32(char *desc, SAMR_Q_UNKNOWN_32 *q_u, prs_struct *ps, int depth) +BOOL samr_io_q_create_user(char *desc, SAMR_Q_CREATE_USER *q_u, prs_struct *ps, int depth) { if (q_u == NULL) return False; - prs_debug(ps, depth, desc, "samr_io_q_unknown_32"); + prs_debug(ps, depth, desc, "samr_io_q_create_user"); depth++; if(!prs_align(ps)) @@ -3096,7 +3096,7 @@ BOOL samr_io_q_unknown_32(char *desc, SAMR_Q_UNKNOWN_32 *q_u, prs_struct *ps, i Reads or writes a structure. ********************************************************************/ -BOOL samr_io_r_unknown_32(char *desc, SAMR_R_UNKNOWN_32 *r_u, prs_struct *ps, int depth) +BOOL samr_io_r_create_user(char *desc, SAMR_R_CREATE_USER *r_u, prs_struct *ps, int depth) { if (r_u == NULL) return False; diff --git a/source3/rpc_server/srv_samr.c b/source3/rpc_server/srv_samr.c index 95c3e7c6ca..ab32bfe563 100644 --- a/source3/rpc_server/srv_samr.c +++ b/source3/rpc_server/srv_samr.c @@ -1827,54 +1827,24 @@ static BOOL api_samr_query_dom_info(pipes_struct *p) } /******************************************************************* - samr_reply_unknown_32 + api_samr_create_user ********************************************************************/ -static BOOL samr_reply_unknown_32(SAMR_Q_UNKNOWN_32 *q_u, - prs_struct *rdata, - int status) -{ - int i; - SAMR_R_UNKNOWN_32 r_u; - - /* set up the SAMR unknown_32 response */ - memset((char *)r_u.pol.data, '\0', POL_HND_SIZE); - if (status == 0) - { - for (i = 4; i < POL_HND_SIZE; i++) - { - r_u.pol.data[i] = i+1; - } - } - - init_dom_rid4(&(r_u.rid4), 0x0030, 0, 0); - r_u.status = status; - - DEBUG(5,("samr_unknown_32: %d\n", __LINE__)); - - /* store the response in the SMB stream */ - if(!samr_io_r_unknown_32("", &r_u, rdata, 0)) - return False; - - DEBUG(5,("samr_unknown_32: %d\n", __LINE__)); - - return True; -} - -/******************************************************************* - api_samr_unknown_32 - ********************************************************************/ -static BOOL api_samr_unknown_32(pipes_struct *p) +static BOOL api_samr_create_user(pipes_struct *p) { uint32 status = 0; struct sam_passwd *sam_pass; fstring mach_acct; prs_struct *data = &p->in_data.data; prs_struct *rdata = &p->out_data.rdata; + int i; - SAMR_Q_UNKNOWN_32 q_u; + SAMR_Q_CREATE_USER q_u; + SAMR_R_CREATE_USER r_u; - /* grab the samr unknown 32 */ - samr_io_q_unknown_32("", &q_u, data, 0); + DEBUG(5,("api_samr_create_user: %d\n", __LINE__)); + + /* grab the samr create user */ + samr_io_q_create_user("", &q_u, data, 0); /* find the machine account: tell the caller if it exists. lkclXXXX i have *no* idea if this is a problem or not @@ -1882,29 +1852,38 @@ static BOOL api_samr_unknown_32(pipes_struct *p) reply if the account already exists... */ - fstrcpy(mach_acct, dos_unistrn2(q_u.uni_mach_acct.buffer, - q_u.uni_mach_acct.uni_str_len)); + fstrcpy(mach_acct, dos_unistrn2(q_u.uni_mach_acct.buffer, q_u.uni_mach_acct.uni_str_len)); become_root(); sam_pass = getsam21pwnam(mach_acct); unbecome_root(); - if (sam_pass != NULL) - { + if (sam_pass != NULL) { /* machine account exists: say so */ status = 0xC0000000 | NT_STATUS_USER_EXISTS; - } - else - { + } else { /* this could cause trouble... */ DEBUG(0,("trouble!\n")); status = 0; } - /* construct reply. */ - if(!samr_reply_unknown_32(&q_u, rdata, status)) + /* set up the SAMR create_user response */ + memset((char *)r_u.pol.data, '\0', POL_HND_SIZE); + if (status == 0) { + for (i = 4; i < POL_HND_SIZE; i++) { + r_u.pol.data[i] = i+1; + } + } + + init_dom_rid4(&(r_u.rid4), 0x0030, 0, 0); + r_u.status = status; + + /* store the response in the SMB stream */ + if(!samr_io_r_create_user("", &r_u, rdata, 0)) return False; + DEBUG(5,("api_samr_create_user: %d\n", __LINE__)); + return True; } @@ -2197,7 +2176,7 @@ static struct api_struct api_samr_cmds [] = { "SAMR_QUERY_USERGROUPS" , SAMR_QUERY_USERGROUPS , api_samr_query_usergroups }, { "SAMR_QUERY_DISPINFO" , SAMR_QUERY_DISPINFO , api_samr_query_dispinfo }, { "SAMR_QUERY_ALIASINFO" , SAMR_QUERY_ALIASINFO , api_samr_query_aliasinfo }, - { "SAMR_0x32" , 0x32 , api_samr_unknown_32 }, + { "SAMR_CREATE_USER" , SAMR_CREATE_USER , api_samr_create_user }, { "SAMR_UNKNOWN_12" , SAMR_UNKNOWN_12 , api_samr_unknown_12 }, { "SAMR_UNKNOWN_38" , SAMR_UNKNOWN_38 , api_samr_unknown_38 }, { "SAMR_CHGPASSWD_USER" , SAMR_CHGPASSWD_USER , api_samr_chgpasswd_user }, |