X-Git-Url: http://git.samba.org/samba.git/?a=blobdiff_plain;f=source3%2Flib%2Fsystem.c;h=52b64772666499adc6fae52e287bbf1559c3013f;hb=0e771263eed0b9bc364ce523765ea17dd1192841;hp=57434f2d4210fdd65a069295f6dcf122222b85b7;hpb=1911d483e552a6ec73b2c107b968268e7e9111e5;p=ira%2Fwip.git diff --git a/source3/lib/system.c b/source3/lib/system.c index 57434f2d421..52b64772666 100644 --- a/source3/lib/system.c +++ b/source3/lib/system.c @@ -21,6 +21,10 @@ */ #include "includes.h" +#include "system/syslog.h" +#include "system/capability.h" +#include "system/passwd.h" +#include "system/filesys.h" #ifdef HAVE_SYS_PRCTL_H #include @@ -868,13 +872,15 @@ SMB_STRUCT_DIR *sys_opendir(const char *name) /******************************************************************* An fdopendir wrapper that will deal with 64 bit filesizes. + Ugly hack - we need dirfd for this to work correctly in the + calling code.. JRA. ********************************************************************/ SMB_STRUCT_DIR *sys_fdopendir(int fd) { -#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_FDOPENDIR64) +#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_FDOPENDIR64) && defined(HAVE_DIRFD) return fdopendir64(fd); -#elif defined(HAVE_FDOPENDIR) +#elif defined(HAVE_FDOPENDIR) && defined(HAVE_DIRFD) return fdopendir(fd); #else errno = ENOSYS; @@ -1134,6 +1140,10 @@ void sys_srandom(unsigned int seed) #endif } +#ifndef NGROUPS_MAX +#define NGROUPS_MAX 32 /* Guess... */ +#endif + /************************************************************************** Returns equivalent to NGROUPS_MAX - using sysconf if needed. ****************************************************************************/ @@ -1154,6 +1164,13 @@ int groups_max(void) ****************************************************************************/ #if defined(HAVE_BROKEN_GETGROUPS) + +#ifdef HAVE_BROKEN_GETGROUPS +#define GID_T int +#else +#define GID_T gid_t +#endif + static int sys_broken_getgroups(int setlen, gid_t *gidset) { GID_T gid; @@ -1332,50 +1349,6 @@ int sys_setgroups(gid_t UNUSED(primary_gid), int setlen, gid_t *gidset) #endif } -/************************************************************************** - Wrappers for setpwent(), getpwent() and endpwent() -****************************************************************************/ - -void sys_setpwent(void) -{ - setpwent(); -} - -struct passwd *sys_getpwent(void) -{ - return getpwent(); -} - -void sys_endpwent(void) -{ - endpwent(); -} - -/************************************************************************** - Wrappers for getpwnam(), getpwuid(), getgrnam(), getgrgid() -****************************************************************************/ - - -struct passwd *sys_getpwnam(const char *name) -{ - return getpwnam(name); -} - -struct passwd *sys_getpwuid(uid_t uid) -{ - return getpwuid(uid); -} - -struct group *sys_getgrnam(const char *name) -{ - return getgrnam(name); -} - -struct group *sys_getgrgid(gid_t gid) -{ - return getgrgid(gid); -} - /************************************************************************** Extract a command into an arg list. ****************************************************************************/ @@ -1543,7 +1516,7 @@ int sys_popen(const char *command) err_exit: SAFE_FREE(entry); - SAFE_FREE(argl); + TALLOC_FREE(argl); close(pipe_fds[0]); close(pipe_fds[1]); return -1; @@ -2716,7 +2689,7 @@ int sys_getnameinfo(const struct sockaddr *psa, int sys_connect(int fd, const struct sockaddr * addr) { - socklen_t salen = -1; + socklen_t salen = (socklen_t)-1; if (addr->sa_family == AF_INET) { salen = sizeof(struct sockaddr_in);