X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fuser.c;h=358e6f38116fab2bb7179e719b93dd45befbcb3a;hb=5747896ba081ff998fd97863de26d2f4af59bbd2;hp=29aa25b4298e9f2f5fd05610e4f390c3f00da87c;hpb=dc0eacd40b625258355eea866d62188e5aa7ce3b;p=openldap
diff --git a/servers/slapd/user.c b/servers/slapd/user.c
index 29aa25b429..358e6f3811 100644
--- a/servers/slapd/user.c
+++ b/servers/slapd/user.c
@@ -2,7 +2,7 @@
/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software .
*
- * Copyright 1998-2005 The OpenLDAP Foundation.
+ * Copyright 1998-2006 The OpenLDAP Foundation.
* Portions Copyright 1999 PM Lashley.
* All rights reserved.
*
@@ -34,6 +34,7 @@
#include
#include "slap.h"
+#include "lutil.h"
/*
* Set real and effective user id and group id, and group access list
@@ -49,9 +50,17 @@ slap_init_user( char *user, char *group )
if ( user ) {
struct passwd *pwd;
- if ( isdigit( (unsigned char) *user )) {
+ if ( isdigit( (unsigned char) *user ) ) {
+ unsigned u;
+
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
pwd = getpwuid( uid );
goto did_getpw;
@@ -86,7 +95,15 @@ slap_init_user( char *user, char *group )
if ( group ) {
struct group *grp;
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
grp = getgrgid( gid );
goto did_group;