fixed signed / unsigned warnings spotted by tim winders. also fixed
[kai/samba.git] / source3 / rpc_server / srv_samr.c
index 821ae75c11056ae8116e602ee3ca0ca9e5b1187d..d0304d0dd6a8e458cd9d951ddbe3bf9651263de4 100644 (file)
@@ -53,14 +53,14 @@ static BOOL get_sampwd_entries(SAM_USER_INFO_21 *pw_buf,
 
        if (pw_buf == NULL) return False;
 
-       vp = startsampwent(False);
+       vp = startsmbpwent(False);
        if (!vp)
        {
-               DEBUG(0, ("get_sampwd_entries: Unable to open SMB password file.\n"));
+               DEBUG(0, ("get_sampwd_entries: Unable to open SMB password database.\n"));
                return False;
        }
 
-       while (((pwd = getsampwent(vp)) != NULL) && (*num_entries) < max_num_entries)
+       while (((pwd = getsmbpwent(vp)) != NULL) && (*num_entries) < max_num_entries)
        {
                int user_name_len = strlen(pwd->smb_name);
                make_unistr2(&(pw_buf[(*num_entries)].uni_user_name), pwd->smb_name, user_name_len-1);
@@ -77,7 +77,7 @@ static BOOL get_sampwd_entries(SAM_USER_INFO_21 *pw_buf,
 
                pw_buf[(*num_entries)].acb_info = (uint16)pwd->acct_ctrl;
 
-               DEBUG(5, ("get_sampwd_entries: idx: %d user %s, uid %d, acb %x",
+               DEBUG(5, ("get_smbpwd_entries: idx: %d user %s, uid %d, acb %x",
                (*num_entries), pwd->smb_name, pwd->smb_userid, pwd->acct_ctrl));
 
                if (acb_mask == 0 || IS_BITS_SET_SOME(pwd->acct_ctrl, acb_mask))
@@ -93,7 +93,7 @@ static BOOL get_sampwd_entries(SAM_USER_INFO_21 *pw_buf,
                (*total_entries)++;
        }
 
-       endsampwent(vp);
+       endsmbpwent(vp);
 
        return (*num_entries) > 0;
 }
@@ -107,7 +107,7 @@ static void samr_reply_close_hnd(SAMR_Q_CLOSE_HND *q_u,
        SAMR_R_CLOSE_HND r_u;
 
        /* set up the SAMR unknown_1 response */
-       bzero(&(r_u.pol.data), POL_HND_SIZE);
+       bzero(r_u.pol.data, POL_HND_SIZE);
 
        /* close the policy handle */
        if (close_lsa_policy_hnd(&(q_u->pol)))
@@ -795,7 +795,7 @@ static void samr_reply_open_user(SAMR_Q_OPEN_USER *q_u,
        BOOL pol_open = False;
 
        /* set up the SAMR open_user response */
-       bzero(&(r_u.user_pol.data), POL_HND_SIZE);
+       bzero(r_u.user_pol.data, POL_HND_SIZE);
 
        r_u.status = 0x0;
 
@@ -812,7 +812,7 @@ static void samr_reply_open_user(SAMR_Q_OPEN_USER *q_u,
        }
 
        become_root(True);
-       smb_pass = getsampwuid(q_u->user_rid);
+       smb_pass = getsmbpwuid(q_u->user_rid);
        unbecome_root(True);
 
        /* check that the RID exists in our domain. */
@@ -860,16 +860,20 @@ static void api_samr_open_user( int uid, prs_struct *data, prs_struct *rdata)
 /*************************************************************************
  get_user_info_21
  *************************************************************************/
-static BOOL get_user_info_21(SAM_USER_INFO_21 *id21, uint32 rid)
+static BOOL get_user_info_21(SAM_USER_INFO_21 *id21, uint32 user_rid)
 {
        NTTIME dummy_time;
        struct sam_passwd *sam_pass;
-
        LOGON_HRS hrs;
        int i;
 
+       if (!pdb_rid_is_user(user_rid))
+       {
+               return False;
+       }
+
        become_root(True);
-       sam_pass = getsam21pwrid(rid);
+       sam_pass = getsam21pwrid(user_rid);
        unbecome_root(True);
 
        if (sam_pass == NULL)
@@ -1047,7 +1051,7 @@ static void samr_reply_query_usergroups(SAMR_Q_QUERY_USERGROUPS *q_u,
        if (status == 0x0)
        {
                become_root(True);
-               smb_pass = getsampwuid(rid);
+               smb_pass = getsmbpwuid(rid);
                unbecome_root(True);
 
                if (smb_pass == NULL)
@@ -1101,7 +1105,7 @@ static void samr_reply_unknown_32(SAMR_Q_UNKNOWN_32 *q_u,
        SAMR_R_UNKNOWN_32 r_u;
 
        /* set up the SAMR unknown_32 response */
-       bzero(&(r_u.pol.data), POL_HND_SIZE);
+       bzero(r_u.pol.data, POL_HND_SIZE);
        if (status == 0)
        {
                for (i = 4; i < POL_HND_SIZE; i++)
@@ -1146,7 +1150,7 @@ static void api_samr_unknown_32( int uid, prs_struct *data, prs_struct *rdata)
                                    q_u.uni_mach_acct.uni_str_len));
 
        become_root(True);
-       smb_pass = getsampwnam(mach_acct);
+       smb_pass = getsmbpwnam(mach_acct);
        unbecome_root(True);
 
        if (smb_pass != NULL)