summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2002-06-15 00:47:52 +0000
committerAndrew Bartlett <abartlet@samba.org>2002-06-15 00:47:52 +0000
commit9026074f6068f68725241c3e14f7f38bfa698b16 (patch)
tree4ac900ab034a9813aff43fb89c3b5010d4990290 /source3/lib
parent59e0dff0c78add442cb60e72ca7cad7eb1bc7219 (diff)
downloadsamba-9026074f6068f68725241c3e14f7f38bfa698b16.tar.gz
samba-9026074f6068f68725241c3e14f7f38bfa698b16.tar.bz2
samba-9026074f6068f68725241c3e14f7f38bfa698b16.zip
Add back sys_getpwnam() and freinds to the system.c interface, but don't
use the silly cache any more. Also add group functions and fix a few callers. Andrew Bartlett (This used to be commit 41d4b94077c118ecde2bf8792b9bb7ab71c6403e)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/system.c24
-rw-r--r--source3/lib/util.c2
-rw-r--r--source3/lib/util_pw.c4
-rw-r--r--source3/lib/util_sock.c4
4 files changed, 29 insertions, 5 deletions
diff --git a/source3/lib/system.c b/source3/lib/system.c
index 3bf0994621..8b2ba800f5 100644
--- a/source3/lib/system.c
+++ b/source3/lib/system.c
@@ -763,6 +763,30 @@ 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);
+}
+
#if 0 /* NOT CURRENTLY USED - JRA */
/**************************************************************************
The following are the UNICODE versions of *all* system interface functions
diff --git a/source3/lib/util.c b/source3/lib/util.c
index fe1011668d..92c8850cef 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -1122,7 +1122,7 @@ gid_t nametogid(const char *name)
if ((p != name) && (*p == '\0'))
return g;
- grp = getgrnam(name);
+ grp = sys_getgrnam(name);
if (grp)
return(grp->gr_gid);
return (gid_t)-1;
diff --git a/source3/lib/util_pw.c b/source3/lib/util_pw.c
index 47711788c7..9d075a05e8 100644
--- a/source3/lib/util_pw.c
+++ b/source3/lib/util_pw.c
@@ -56,7 +56,7 @@ struct passwd *getpwnam_alloc(const char *name)
{
struct passwd *temp;
- temp = getpwnam(name);
+ temp = sys_getpwnam(name);
if (!temp) {
#if 0
@@ -74,7 +74,7 @@ struct passwd *getpwuid_alloc(uid_t uid)
{
struct passwd *temp;
- temp = getpwuid(uid);
+ temp = sys_getpwuid(uid);
if (!temp) {
#if 0
diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c
index f5d56eb0d4..e9e2ab8291 100644
--- a/source3/lib/util_sock.c
+++ b/source3/lib/util_sock.c
@@ -1042,8 +1042,8 @@ int open_pipe_sock(char *path)
permissions, instead.
******************************************************************/
int create_pipe_sock(const char *socket_dir,
- const char *socket_name,
- mode_t dir_perms)
+ const char *socket_name,
+ mode_t dir_perms)
{
struct sockaddr_un sunaddr;
struct stat st;