summaryrefslogtreecommitdiff
path: root/source3/rpc_server
diff options
context:
space:
mode:
authorJean-François Micouleau <jfm@samba.org>2000-09-27 13:02:57 +0000
committerJean-François Micouleau <jfm@samba.org>2000-09-27 13:02:57 +0000
commit8c93ddf3e0ea80d482cbee7bf233c32fc69955bb (patch)
treeca4da3e33310108a2e455da1aeb554d12ca2d7fa /source3/rpc_server
parente8fbf2cbadb81eee9e342da7bdbe6f30c3bb7cb2 (diff)
downloadsamba-8c93ddf3e0ea80d482cbee7bf233c32fc69955bb.tar.gz
samba-8c93ddf3e0ea80d482cbee7bf233c32fc69955bb.tar.bz2
samba-8c93ddf3e0ea80d482cbee7bf233c32fc69955bb.zip
samr unknown 0x32 is in fact samr create user.
so renamed and tidy up of the server function. J.F. (This used to be commit 0f707ac1fb5685b800d6599b9074ec1d4e65b1c1)
Diffstat (limited to 'source3/rpc_server')
-rw-r--r--source3/rpc_server/srv_samr.c77
1 files changed, 28 insertions, 49 deletions
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 },