Diff for /servers/slapd/user.c between versions 1.21 and 1.22

version 1.21, 2004/01/01 18:15:32 version 1.22, 2004/09/04 02:54:31
Line 1 Line 1
 /* user.c - set user id, group id and group access list */  /* user.c - set user id, group id and group access list */
 /* $OpenLDAP: pkg/ldap/servers/slapd/user.c,v 1.20 2003/11/27 00:17:16 kurt Exp $ */  /* $OpenLDAP: pkg/ldap/servers/slapd/user.c,v 1.21 2004/01/01 18:15:32 kurt Exp $ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.  /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *   *
  * Copyright 1998-2004 The OpenLDAP Foundation.   * Copyright 1998-2004 The OpenLDAP Foundation.
Line 63  slap_init_user( char *user, char *group Line 63  slap_init_user( char *user, char *group
             pwd = getpwnam( user );              pwd = getpwnam( user );
         did_getpw:          did_getpw:
             if ( pwd == NULL ) {              if ( pwd == NULL ) {
 #ifdef NEW_LOGGING  
                     LDAP_LOG( OPERATION, INFO,   
                                 "slap_init_user: No passwd entry for user %s\n", user, 0, 0 );  
 #else  
                 Debug( LDAP_DEBUG_ANY, "No passwd entry for user %s\n",                  Debug( LDAP_DEBUG_ANY, "No passwd entry for user %s\n",
                        user, 0, 0 );                         user, 0, 0 );
 #endif  
   
                 exit( EXIT_FAILURE );                  exit( EXIT_FAILURE );
             }              }
Line 102  slap_init_user( char *user, char *group Line 97  slap_init_user( char *user, char *group
                 gid = grp->gr_gid;                  gid = grp->gr_gid;
         did_group:          did_group:
             if ( grp == NULL ) {              if ( grp == NULL ) {
 #ifdef NEW_LOGGING  
                 LDAP_LOG( OPERATION, INFO,   
                         "slap_init_user: No group entry for group %s\n", group, 0, 0 );  
 #else  
                 Debug( LDAP_DEBUG_ANY, "No group entry for group %s\n",                  Debug( LDAP_DEBUG_ANY, "No group entry for group %s\n",
                        group, 0, 0 );                         group, 0, 0 );
 #endif  
   
                 exit( EXIT_FAILURE );                  exit( EXIT_FAILURE );
             }              }
Line 119  slap_init_user( char *user, char *group Line 109  slap_init_user( char *user, char *group
   
     if ( user ) {      if ( user ) {
         if ( getuid() == 0 && initgroups( user, gid ) != 0 ) {          if ( getuid() == 0 && initgroups( user, gid ) != 0 ) {
 #ifdef NEW_LOGGING  
             LDAP_LOG( OPERATION, INFO,  
                         "slap_init_user: Could not set the group access (gid) list.\n",   
                         0, 0, 0 );  
 #else  
             Debug( LDAP_DEBUG_ANY,              Debug( LDAP_DEBUG_ANY,
                    "Could not set the group access (gid) list\n", 0, 0, 0 );                     "Could not set the group access (gid) list\n", 0, 0, 0 );
 #endif  
   
             exit( EXIT_FAILURE );              exit( EXIT_FAILURE );
         }          }
Line 139  slap_init_user( char *user, char *group Line 123  slap_init_user( char *user, char *group
   
     if ( got_gid ) {      if ( got_gid ) {
         if ( setgid( gid ) != 0 ) {          if ( setgid( gid ) != 0 ) {
 #ifdef NEW_LOGGING  
             LDAP_LOG( OPERATION, INFO,   
                         "slap_init_user: could not set real group id to %d\n",   
                         (int)gid, 0, 0);  
 #else  
             Debug( LDAP_DEBUG_ANY, "Could not set real group id to %d\n",              Debug( LDAP_DEBUG_ANY, "Could not set real group id to %d\n",
                        (int) gid, 0, 0 );                         (int) gid, 0, 0 );
 #endif  
   
             exit( EXIT_FAILURE );              exit( EXIT_FAILURE );
         }          }
 #ifdef HAVE_SETEGID  #ifdef HAVE_SETEGID
         if ( setegid( gid ) != 0 ) {          if ( setegid( gid ) != 0 ) {
 #ifdef NEW_LOGGING  
             LDAP_LOG( OPERATION, INFO,   
                    "slap_init_user: Could not set effective group id to %d\n",  
                    (int)gid, 0, 0);  
 #else  
             Debug( LDAP_DEBUG_ANY, "Could not set effective group id to %d\n",              Debug( LDAP_DEBUG_ANY, "Could not set effective group id to %d\n",
                        (int) gid, 0, 0 );                         (int) gid, 0, 0 );
 #endif  
   
             exit( EXIT_FAILURE );              exit( EXIT_FAILURE );
         }          }
Line 168  slap_init_user( char *user, char *group Line 140  slap_init_user( char *user, char *group
   
     if ( got_uid ) {      if ( got_uid ) {
         if ( setuid( uid ) != 0 ) {          if ( setuid( uid ) != 0 ) {
 #ifdef NEW_LOGGING  
             LDAP_LOG( OPERATION, INFO,   
                         "slap_init_user: Could not set real user id to %d\n",   
                         (int)uid, 0, 0 );  
 #else  
             Debug( LDAP_DEBUG_ANY, "Could not set real user id to %d\n",              Debug( LDAP_DEBUG_ANY, "Could not set real user id to %d\n",
                        (int) uid, 0, 0 );                         (int) uid, 0, 0 );
 #endif  
   
             exit( EXIT_FAILURE );              exit( EXIT_FAILURE );
         }          }
 #ifdef HAVE_SETEUID  #ifdef HAVE_SETEUID
         if ( seteuid( uid ) != 0 ) {          if ( seteuid( uid ) != 0 ) {
 #ifdef NEW_LOGGING  
             LDAP_LOG( OPERATION, INFO,   
                         "slap_init_user: Could not set effective user id to %d\n",   
                         (int)uid, 0, 0 );  
 #else  
             Debug( LDAP_DEBUG_ANY, "Could not set effective user id to %d\n",              Debug( LDAP_DEBUG_ANY, "Could not set effective user id to %d\n",
                        (int) uid, 0, 0 );                         (int) uid, 0, 0 );
 #endif  
   
             exit( EXIT_FAILURE );              exit( EXIT_FAILURE );
         }          }

Removed from v.1.21  
changed lines
  Added in v.1.22


______________
© Copyright 1998-2020, OpenLDAP Foundation, info@OpenLDAP.org