+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
/* user.c - set user id, group id and group access list
*
- * Copyright 1999 by PM Lashley and The OpenLDAP Foundation.
+ * Copyright 1999 by PM Lashley.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted only
if ( pwd == NULL ) {
Debug( LDAP_DEBUG_ANY, "No passwd entry for user %s\n",
user, 0, 0 );
- exit( 1 );
+ exit( EXIT_FAILURE );
}
if ( got_uid ) {
free( user );
if ( grp == NULL ) {
Debug( LDAP_DEBUG_ANY, "No group entry for group %s\n",
group, 0, 0 );
- exit( 1 );
+ exit( EXIT_FAILURE );
}
}
free( group );
if ( getuid() == 0 && initgroups( user, gid ) != 0 ) {
Debug( LDAP_DEBUG_ANY,
"Could not set the group access (gid) list\n", 0, 0, 0 );
- exit( 1 );
+ exit( EXIT_FAILURE );
}
free( user );
}
if ( got_gid ) {
if ( setgid( gid ) != 0 ) {
Debug( LDAP_DEBUG_ANY, "Could not set real group id to %d\n",
- gid, 0, 0 );
- exit( 1 );
+ (int) gid, 0, 0 );
+ exit( EXIT_FAILURE );
}
#ifdef HAVE_SETEGID
if ( setegid( gid ) != 0 ) {
Debug( LDAP_DEBUG_ANY, "Could not set effective group id to %d\n",
- gid, 0, 0 );
- exit( 1 );
+ (int) gid, 0, 0 );
+ exit( EXIT_FAILURE );
}
#endif
}
if ( got_uid ) {
if ( setuid( uid ) != 0 ) {
Debug( LDAP_DEBUG_ANY, "Could not set real user id to %d\n",
- uid, 0, 0 );
- exit( 1 );
+ (int) uid, 0, 0 );
+ exit( EXIT_FAILURE );
}
#ifdef HAVE_SETEUID
if ( seteuid( uid ) != 0 ) {
Debug( LDAP_DEBUG_ANY, "Could not set effective user id to %d\n",
- uid, 0, 0 );
- exit( 1 );
+ (int) uid, 0, 0 );
+ exit( EXIT_FAILURE );
}
#endif
}