Author: gd
Date: 2005-01-24 17:29:12 +0000 (Mon, 24 Jan 2005)
New Revision: 4964

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=4964

Log:
Fix our lsa lookupsid $OURDOMAINSID-500.

Give the admin-user (rid 500) a chance to be found in passdb, not
returning the (possibly obscure) first entry of "admin users" before
that.

Guenther

Modified:
   branches/SAMBA_3_0/source/passdb/passdb.c
   trunk/source/passdb/passdb.c


Changeset:
Modified: branches/SAMBA_3_0/source/passdb/passdb.c
===================================================================
--- branches/SAMBA_3_0/source/passdb/passdb.c   2005-01-24 16:30:46 UTC (rev 
4963)
+++ branches/SAMBA_3_0/source/passdb/passdb.c   2005-01-24 17:29:12 UTC (rev 
4964)
@@ -759,24 +759,11 @@
        
        DEBUG(5,("local_lookup_sid: looking up RID %u.\n", (unsigned int)rid));
        
-       if (rid == DOMAIN_USER_RID_ADMIN) {
-               const char **admin_list = lp_admin_users(-1);
-               *psid_name_use = SID_NAME_USER;
-               if (admin_list) {
-                       const char *p = *admin_list;
-                       if(!next_token(&p, name, NULL, sizeof(fstring)))
-                               fstrcpy(name, "Administrator");
-               } else {
-                       fstrcpy(name, "Administrator");
-               }
-               return True;
-       }
 
+       /* see if the passdb can help us with the name of the user */
        if (!NT_STATUS_IS_OK(pdb_init_sam(&sam_account))) {
                return False;
        }
-       
-       /* see if the passdb can help us with the name of the user */
 
        /* BEING ROOT BLLOCK */
        become_root();
@@ -807,6 +794,20 @@
                return True;
        }
 
+       if (rid == DOMAIN_USER_RID_ADMIN) {
+               const char **admin_list = lp_admin_users(-1);
+               *psid_name_use = SID_NAME_USER;
+               if (admin_list) {
+                       const char *p = *admin_list;
+                       if(!next_token(&p, name, NULL, sizeof(fstring))) {
+                               fstrcpy(name, "Administrator");
+                       }
+               } else {
+                       fstrcpy(name, "Administrator");
+               }
+               return True;
+       }
+
        if (algorithmic_pdb_rid_is_user(rid)) {
                uid_t uid;
                struct passwd *pw = NULL;

Modified: trunk/source/passdb/passdb.c
===================================================================
--- trunk/source/passdb/passdb.c        2005-01-24 16:30:46 UTC (rev 4963)
+++ trunk/source/passdb/passdb.c        2005-01-24 17:29:12 UTC (rev 4964)
@@ -771,24 +771,11 @@
        
        DEBUG(5,("local_lookup_sid: looking up RID %u.\n", (unsigned int)rid));
        
-       if (rid == DOMAIN_USER_RID_ADMIN) {
-               const char **admin_list = lp_admin_users(-1);
-               *psid_name_use = SID_NAME_USER;
-               if (admin_list) {
-                       const char *p = *admin_list;
-                       if(!next_token(&p, name, NULL, sizeof(fstring)))
-                               fstrcpy(name, "Administrator");
-               } else {
-                       fstrcpy(name, "Administrator");
-               }
-               return True;
-       }
 
+       /* see if the passdb can help us with the name of the user */
        if (!NT_STATUS_IS_OK(pdb_init_sam(&sam_account))) {
                return False;
        }
-       
-       /* see if the passdb can help us with the name of the user */
 
        /* BEING ROOT BLLOCK */
        become_root();
@@ -819,6 +806,20 @@
                return True;
        }
 
+       if (rid == DOMAIN_USER_RID_ADMIN) {
+               const char **admin_list = lp_admin_users(-1);
+               *psid_name_use = SID_NAME_USER;
+               if (admin_list) {
+                       const char *p = *admin_list;
+                       if(!next_token(&p, name, NULL, sizeof(fstring))) {
+                               fstrcpy(name, "Administrator");
+                       }
+               } else {
+                       fstrcpy(name, "Administrator");
+               }
+               return True;
+       }
+
        if (algorithmic_pdb_rid_is_user(rid)) {
                uid_t uid;
                struct passwd *pw = NULL;

Reply via email to