diff options
author | Jeff Layton <jlayton@samba.org> | 2012-01-17 14:43:23 -0500 |
---|---|---|
committer | Jeff Layton <jlayton@samba.org> | 2012-01-17 14:43:23 -0500 |
commit | 9da16c91477293e7b367127b0bdec92d9613440f (patch) | |
tree | 592b72ad0c8ce3d12d64ddc5ae52de1cb04e535e | |
parent | 92be8b6775958814d39fb19247ff85947a2e4f9e (diff) | |
download | cifs-utils-9da16c91477293e7b367127b0bdec92d9613440f.tar.gz cifs-utils-9da16c91477293e7b367127b0bdec92d9613440f.tar.bz2 cifs-utils-9da16c91477293e7b367127b0bdec92d9613440f.zip |
util: move getusername to util.c
Signed-off-by: Jeff Layton <jlayton@samba.org>
-rw-r--r-- | mount.cifs.c | 11 | ||||
-rw-r--r-- | util.c | 13 | ||||
-rw-r--r-- | util.h | 1 |
3 files changed, 14 insertions, 11 deletions
diff --git a/mount.cifs.c b/mount.cifs.c index 78a4811..a46a22c 100644 --- a/mount.cifs.c +++ b/mount.cifs.c @@ -363,17 +363,6 @@ static int set_password(struct parsed_mount_info *parsed_info, const char *src) return 0; } -/* caller frees username if necessary */ -static char *getusername(uid_t uid) -{ - char *username = NULL; - struct passwd *password = getpwuid(uid); - - if (password) - username = password->pw_name; - return username; -} - /* * Parse a username string into parsed_mount_info fields. The format is: * @@ -24,6 +24,7 @@ #include <sys/types.h> #include <string.h> +#include <pwd.h> /* glibc doesn't have strlcpy, strlcat. Ensure we do. JRA. We * don't link to libreplace so need them here. */ @@ -69,3 +70,15 @@ size_t strlcat(char *d, const char *s, size_t bufsize) } #endif +/* caller frees username if necessary */ +char * +getusername(uid_t uid) +{ + char *username = NULL; + struct passwd *password = getpwuid(uid); + + if (password) + username = password->pw_name; + return username; +} + @@ -28,5 +28,6 @@ size_t strlcpy(char *d, const char *s, size_t bufsize); size_t strlcat(char *d, const char *s, size_t bufsize); +char *getusername(uid_t uid); #endif /* _LIBUTIL_H */ |