cvs being STUPID
authorLuke Leighton <lkcl@samba.org>
Mon, 23 Nov 1998 22:45:36 +0000 (22:45 +0000)
committerLuke Leighton <lkcl@samba.org>
Mon, 23 Nov 1998 22:45:36 +0000 (22:45 +0000)
(This used to be commit 22802195ed544b6042d791b34e704d608bbdfd84)

source3/groupdb/aliasdb.c
source3/groupdb/aliasfile.c
source3/groupdb/groupfile.c

index 03e0a6e11ae612a2e637466a5948c6499df7bc8d..e37f4912879351eee6f525ad50d8bbfc79463090 100644 (file)
@@ -32,7 +32,7 @@ extern fstring global_sam_name;
  * that points to the correct function for the selected database. JRA.
  */
 
-static struct aliasdb_ops *aldb_ops;
+static struct aliasdb_ops *aldb_ops = NULL;
 
 /***************************************************************
  Initialise the alias db operations.
@@ -49,8 +49,8 @@ BOOL initialise_alias_db(void)
   aldb_ops =  nisplus_initialise_alias_db();
 #elif defined(WITH_LDAP)
   aldb_ops = ldap_initialise_alias_db();
-#else 
-  aldb_ops = file_initialise_alias_db();
+#elif defined(USE_SMBUNIX_DB)
+  aldb_ops = unix_initialise_alias_db();
 #endif 
 
   return (aldb_ops != NULL);
@@ -380,10 +380,57 @@ BOOL getuseraliasnam(char *user_name, LOCAL_GRP **als, int *num_alss)
 /*************************************************************
  initialises a LOCAL_GRP.
  **************************************************************/
-
 void aldb_init_als(LOCAL_GRP *als)
 {
        if (als == NULL) return;
        ZERO_STRUCTP(als);
 }
 
+/*************************************************************
+ turns an alias entry into a string.
+ **************************************************************/
+BOOL make_alias_line(char *p, int max_len,
+                               LOCAL_GRP *als,
+                               LOCAL_GRP_MEMBER **mem, int *num_mem)
+{
+       int i;
+       int len;
+       len = slprintf(p, max_len-1, "%s:%s:%d:", als->name, als->comment, als->rid);
+
+       if (len == -1)
+       {
+               DEBUG(0,("make_alias_line: cannot create entry\n"));
+               return False;
+       }
+
+       p += len;
+       max_len -= len;
+
+       if (mem == NULL || num_mem == NULL)
+       {
+               return True;
+       }
+
+       for (i = 0; i < (*num_mem); i++)
+       {
+               len = strlen((*mem)[i].name);
+               p = safe_strcpy(p, (*mem)[i].name, max_len); 
+
+               if (p == NULL)
+               {
+                       DEBUG(0, ("make_alias_line: out of space for aliases!\n"));
+                       return False;
+               }
+
+               max_len -= len;
+
+               if (i != (*num_mem)-1)
+               {
+                       *p = ',';
+                       p++;
+                       max_len--;
+               }
+       }
+
+       return True;
+}
index 01166bcc1ff5bb43cd31cdc575c0c3689a0dcf36..e73ff39e7428e3851a5c3539fa427389d3e13b1b 100644 (file)
@@ -19,7 +19,7 @@
 
 #include "includes.h"
 
-#ifdef USE_SMBPASS_DB
+#ifdef USE_SMBGROUP_DB
 
 static int al_file_lock_depth = 0;
 extern int DEBUGLEVEL;
@@ -65,51 +65,6 @@ static BOOL setalsfilepwpos(void *vp, SMB_BIG_UINT tok)
        return setfilepwpos(vp, tok);
 }
 
-static BOOL make_alias_line(char *p, int max_len,
-                               LOCAL_GRP *als,
-                               LOCAL_GRP_MEMBER **mem, int *num_mem)
-{
-       int i;
-       int len;
-       len = slprintf(p, max_len-1, "%s:%s:%d:", als->name, als->comment, als->rid);
-
-       if (len == -1)
-       {
-               DEBUG(0,("make_alias_line: cannot create entry\n"));
-               return False;
-       }
-
-       p += len;
-       max_len -= len;
-
-       if (mem == NULL || num_mem == NULL)
-       {
-               return True;
-       }
-
-       for (i = 0; i < (*num_mem); i++)
-       {
-               len = strlen((*mem)[i].name);
-               p = safe_strcpy(p, (*mem)[i].name, max_len); 
-
-               if (p == NULL)
-               {
-                       DEBUG(0, ("make_alias_line: out of space for aliases!\n"));
-                       return False;
-               }
-
-               max_len -= len;
-
-               if (i != (*num_mem)-1)
-               {
-                       *p = ',';
-                       p++;
-                       max_len--;
-               }
-       }
-
-       return True;
-}
 
 /*************************************************************************
  Routine to return the next entry in the smbdomainalias list.
@@ -136,11 +91,11 @@ static char *get_alias_members(char *p, int *num_mem, LOCAL_GRP_MEMBER **members
                {
                        /* sid entered directly */
                        string_to_sid(&sid, name);
-                       found = lookup_name(&sid, name, &type) == 0x0;
+                       found = lookup_sid(&sid, name, &type) == 0x0;
                }
                else
                {
-                       found = lookup_sid(name, &sid, &type) == 0x0;
+                       found = lookup_name(name, &sid, &type) == 0x0;
                }
 
                if (!found)
index 09939de71e0190ae50bc55227b4eee792b651127..e0f791cafbb1dae0fd9ac1244cdcf1d8b9e0e895 100644 (file)
@@ -19,7 +19,7 @@
 
 #include "includes.h"
 
-#ifdef USE_SMBPASS_DB
+#ifdef USE_SMBGROUP_DB
 
 static int gp_file_lock_depth = 0;
 extern int DEBUGLEVEL;
@@ -68,51 +68,6 @@ static BOOL setgrpfilepwpos(void *vp, SMB_BIG_UINT tok)
        return setfilepwpos(vp, tok);
 }
 
-static BOOL make_group_line(char *p, int max_len,
-                               DOMAIN_GRP *grp,
-                               DOMAIN_GRP_MEMBER **mem, int *num_mem)
-{
-       int i;
-       int len;
-       len = slprintf(p, max_len-1, "%s:%s:%d:", grp->name, grp->comment, grp->rid);
-
-       if (len == -1)
-       {
-               DEBUG(0,("make_group_line: cannot create entry\n"));
-               return False;
-       }
-
-       p += len;
-       max_len -= len;
-
-       if (mem == NULL || num_mem == NULL)
-       {
-               return True;
-       }
-
-       for (i = 0; i < (*num_mem); i++)
-       {
-               len = strlen((*mem)[i].name);
-               p = safe_strcpy(p, (*mem)[i].name, max_len); 
-
-               if (p == NULL)
-               {
-                       DEBUG(0, ("make_group_line: out of space for groups!\n"));
-                       return False;
-               }
-
-               max_len -= len;
-
-               if (i != (*num_mem)-1)
-               {
-                       *p = ',';
-                       p++;
-                       max_len--;
-               }
-       }
-
-       return True;
-}
 
 /*************************************************************************
  Routine to return the next entry in the smbdomaingroup list.
@@ -135,17 +90,17 @@ static char *get_group_members(char *p, int *num_mem, DOMAIN_GRP_MEMBER **member
                uint8 type;
                BOOL found = False;
 
-               if (isdigit(name[0]))
+               if (isdigit(name))
                {
                        uint32 rid = get_number(name);
                        sid_copy(&sid, &global_sam_sid);
                        sid_append_rid(&sid, rid);
                        
-                       found = lookup_name(&sid, name, &type) == 0x0;
+                       found = lookup_sid(&sid, name, &type) == 0x0;
                }
                else
                {
-                       found = lookup_sid(name, &sid, &type) == 0x0;
+                       found = lookup_name(name, &sid, &type) == 0x0;
                }
 
                if (!found)