summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2012-03-24 16:00:36 +0100
committerJelmer Vernooij <jelmer@samba.org>2012-03-24 16:00:36 +0100
commit71d41a015add73e0fb355dd9713e99febd71d46f (patch)
tree866bc9255d36231a0749a59a05c0eb2d05491836 /source3
parent76bb68fd2b9e09eb4c033417f0f1174f18c04797 (diff)
downloadsamba-71d41a015add73e0fb355dd9713e99febd71d46f.tar.gz
samba-71d41a015add73e0fb355dd9713e99febd71d46f.tar.bz2
samba-71d41a015add73e0fb355dd9713e99febd71d46f.zip
libreplace: Add getpeereid implementation.
Diffstat (limited to 'source3')
-rw-r--r--source3/configure.in25
-rw-r--r--source3/rpc_server/rpc_server.c3
-rw-r--r--source3/winbindd/winbindd_ccache_access.c3
-rw-r--r--source3/winbindd/winbindd_pam_logoff.c3
-rw-r--r--source3/wscript8
5 files changed, 6 insertions, 36 deletions
diff --git a/source3/configure.in b/source3/configure.in
index ffa2b808a3..11bd744dc9 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -6577,31 +6577,6 @@ AC_CHECK_MEMBERS([struct secmethod_table.method_attrlist], , ,
AC_CHECK_MEMBERS([struct secmethod_table.method_version], , ,
[#include <usersec.h>])
-AC_CACHE_CHECK([for SO_PEERCRED],samba_cv_HAVE_PEERCRED,[
-AC_TRY_COMPILE([#include <sys/types.h>
-#include <sys/socket.h>],
-[struct ucred cred;
- socklen_t cred_len;
- int ret = getsockopt(0, SOL_SOCKET, SO_PEERCRED, &cred, &cred_len);
-],
-samba_cv_HAVE_PEERCRED=yes,samba_cv_HAVE_PEERCRED=no,samba_cv_HAVE_PEERCRED=cross)])
-if test x"$samba_cv_HAVE_PEERCRED" = x"yes"; then
- AC_DEFINE(HAVE_PEERCRED,1,[Whether we can use SO_PEERCRED to get socket credentials])
-fi
-
-AC_CACHE_CHECK([for getpeereid],samba_cv_HAVE_GETPEEREID,[
-AC_TRY_LINK([#include <sys/types.h>
-#include <unistd.h>],
-[uid_t uid; gid_t gid; int ret;
- ret = getpeereid(0, &uid, &gid);
-],
-samba_cv_HAVE_GETPEEREID=yes,samba_cv_HAVE_GETPEEREID=no)])
-if test x"$samba_cv_HAVE_GETPEEREID" = xyes; then
- AC_DEFINE(HAVE_GETPEEREID,1,
- [Whether we have getpeereid to get socket credentials])
-fi
-
-
#################################################
# Check to see if we should use the included popt
diff --git a/source3/rpc_server/rpc_server.c b/source3/rpc_server/rpc_server.c
index 89885b9230..675d0d5e93 100644
--- a/source3/rpc_server/rpc_server.c
+++ b/source3/rpc_server/rpc_server.c
@@ -1008,6 +1008,7 @@ void dcerpc_ncacn_accept(struct tevent_context *ev_ctx,
NTSTATUS status;
int sys_errno;
uid_t uid;
+ gid_t gid;
int rc;
DEBUG(10, ("dcerpc_ncacn_accept\n"));
@@ -1068,7 +1069,7 @@ void dcerpc_ncacn_accept(struct tevent_context *ev_ctx,
break;
case NCALRPC:
- rc = sys_getpeereid(s, &uid);
+ rc = getpeereid(s, &uid, &gid);
if (rc < 0) {
DEBUG(2, ("Failed to get ncalrpc connecting "
"uid - %s!\n", strerror(errno)));
diff --git a/source3/winbindd/winbindd_ccache_access.c b/source3/winbindd/winbindd_ccache_access.c
index 411b2b4c3a..5557b959f0 100644
--- a/source3/winbindd/winbindd_ccache_access.c
+++ b/source3/winbindd/winbindd_ccache_access.c
@@ -157,10 +157,11 @@ static bool check_client_uid(struct winbindd_cli_state *state, uid_t uid)
{
int ret;
uid_t ret_uid;
+ gid_t ret_gid;
ret_uid = (uid_t)-1;
- ret = sys_getpeereid(state->sock, &ret_uid);
+ ret = getpeereid(state->sock, &ret_uid, &ret_gid);
if (ret != 0) {
DEBUG(1, ("check_client_uid: Could not get socket peer uid: %s; "
"denying access\n", strerror(errno)));
diff --git a/source3/winbindd/winbindd_pam_logoff.c b/source3/winbindd/winbindd_pam_logoff.c
index c32a63e146..b3c60adf85 100644
--- a/source3/winbindd/winbindd_pam_logoff.c
+++ b/source3/winbindd/winbindd_pam_logoff.c
@@ -37,6 +37,7 @@ struct tevent_req *winbindd_pam_logoff_send(TALLOC_CTX *mem_ctx,
struct winbindd_domain *domain;
fstring name_domain, user;
uid_t caller_uid;
+ gid_t caller_gid;
int res;
req = tevent_req_create(mem_ctx, &state,
@@ -71,7 +72,7 @@ struct tevent_req *winbindd_pam_logoff_send(TALLOC_CTX *mem_ctx,
caller_uid = (uid_t)-1;
- res = sys_getpeereid(cli->sock, &caller_uid);
+ res = getpeereid(cli->sock, &caller_uid, &caller_gid);
if (res != 0) {
DEBUG(1,("winbindd_pam_logoff: failed to check peerid: %s\n",
strerror(errno)));
diff --git a/source3/wscript b/source3/wscript
index 476fb109b5..5b480f0ee7 100644
--- a/source3/wscript
+++ b/source3/wscript
@@ -357,14 +357,6 @@ return acl_get_perm_np(permset_d, perm);
conf.CHECK_DECLS('readahead', headers='fcntl.h', always=True)
conf.CHECK_CODE('''
- struct ucred cred;
- socklen_t cred_len;
- int ret = getsockopt(0, SOL_SOCKET, SO_PEERCRED, &cred, &cred_len);''',
- 'HAVE_PEERCRED',
- msg="Checking whether we can use SO_PEERCRED to get socket credentials",
- headers='sys/types.h sys/socket.h')
-
- conf.CHECK_CODE('''
#if defined(HAVE_LONGLONG) && (defined(HAVE_OFF64_T) || (defined(SIZEOF_OFF_T) && (SIZEOF_OFF_T == 8)))
#include <sys/types.h>
#else