version 1.22.2.1, 2005/01/20 18:03:56
|
version 1.22.2.2, 2005/11/26 23:54:49
|
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.22 2004/09/04 02:54:31 kurt Exp $ */ |
/* $OpenLDAP: pkg/ldap/servers/slapd/user.c,v 1.22.2.1 2005/01/20 18:03:56 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-2005 The OpenLDAP Foundation. |
* Copyright 1998-2005 The OpenLDAP Foundation. |
Line 34
|
Line 34
|
#include <ac/unistd.h> |
#include <ac/unistd.h> |
|
|
#include "slap.h" |
#include "slap.h" |
|
#include "lutil.h" |
|
|
/* |
/* |
* Set real and effective user id and group id, and group access list |
* Set real and effective user id and group id, and group access list |
Line 49 slap_init_user( char *user, char *group
|
Line 50 slap_init_user( char *user, char *group
|
|
|
if ( user ) { |
if ( user ) { |
struct passwd *pwd; |
struct passwd *pwd; |
if ( isdigit( (unsigned char) *user )) { |
if ( isdigit( (unsigned char) *user ) ) { |
|
unsigned u; |
|
|
got_uid = 1; |
got_uid = 1; |
uid = atoi( user ); |
if ( lutil_atou( &u, user ) != 0 ) { |
|
Debug( LDAP_DEBUG_ANY, "Unble to parse user %s\n", |
|
user, 0, 0 ); |
|
|
|
exit( EXIT_FAILURE ); |
|
} |
|
uid = (uid_t)u; |
#ifdef HAVE_GETPWUID |
#ifdef HAVE_GETPWUID |
pwd = getpwuid( uid ); |
pwd = getpwuid( uid ); |
goto did_getpw; |
goto did_getpw; |
Line 86 slap_init_user( char *user, char *group
|
Line 95 slap_init_user( char *user, char *group
|
if ( group ) { |
if ( group ) { |
struct group *grp; |
struct group *grp; |
if ( isdigit( (unsigned char) *group )) { |
if ( isdigit( (unsigned char) *group )) { |
gid = atoi( group ); |
unsigned g; |
|
|
|
if ( lutil_atou( &g, group ) != 0 ) { |
|
Debug( LDAP_DEBUG_ANY, "Unble to parse group %s\n", |
|
group, 0, 0 ); |
|
|
|
exit( EXIT_FAILURE ); |
|
} |
|
gid = (uid_t)g; |
#ifdef HAVE_GETGRGID |
#ifdef HAVE_GETGRGID |
grp = getgrgid( gid ); |
grp = getgrgid( gid ); |
goto did_group; |
goto did_group; |