summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2012-01-28 20:03:09 +0300
committerIgor Pashev <pashev.igor@gmail.com>2012-01-28 20:03:09 +0300
commit42fd58e580a99e15d5c647f13fe316af1ce8e1fa (patch)
treeaafb2305fdcabf95a70ebb34aab221f6fbae3f7c
parentf7b824c7543b33610804ef410b9f81c774fb19ed (diff)
downloadlibbsd-42fd58e580a99e15d5c647f13fe316af1ce8e1fa.tar.gz
Fixed getpeereid() : struct ucred_t is not public
-rw-r--r--src/getpeereid.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/getpeereid.c b/src/getpeereid.c
index 8990357..30acf45 100644
--- a/src/getpeereid.c
+++ b/src/getpeereid.c
@@ -99,11 +99,11 @@ getpeereid(int s, uid_t *euid, gid_t *egid)
}
#elif defined(__sun)
/* Solaris */
+#include <ucred.h>
int
getpeereid(int s, uid_t *euid, gid_t *egid)
{
- ucred_t cred_inst;
- ucred_t *cred = &cred_inst;
+ ucred_t *cred;
int ret;
ret = getpeerucred(s, &cred);
@@ -111,11 +111,16 @@ getpeereid(int s, uid_t *euid, gid_t *egid)
return ret;
*euid = ucred_geteuid(cred);
- if (*euid < 0)
+ if (*euid < 0) {
+ ucred_free(cred);
return -1;
- *egid = ucred_getegid(cred);
- if (*egid < 0)
+ }
+
+ *egid = ucred_getegid(cred);
+ if (*egid < 0) {
+ ucred_free(cred);
return -1;
+ }
return 0;
}