diff options
author | Jeremy Allison <jra@samba.org> | 2006-08-19 01:04:54 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:38:43 -0500 |
commit | ae7cc298a113d8984557684bd6ad216cbb27cff3 (patch) | |
tree | 781a129eaae4b282cadcb3af5e40b0c87cdd68d9 /source/lib/system.c | |
parent | 337be14b432e5dfd80c7418b2db4fe0087259b77 (diff) | |
download | samba-ae7cc298a113d8984557684bd6ad216cbb27cff3.tar.gz samba-ae7cc298a113d8984557684bd6ad216cbb27cff3.tar.xz samba-ae7cc298a113d8984557684bd6ad216cbb27cff3.zip |
r17610: Added the ability for firefox to drive the winbindd
ntlm_auth module to allow it to use winbindd cached
credentials.The credentials are currently only stored
in a krb5 MIT environment - we need to add an option to
winbindd to allow passwords to be stored even in an NTLM-only
environment.
Patch from Robert O'Callahan, modified with some fixes
by me.
Jeremy.
Diffstat (limited to 'source/lib/system.c')
-rw-r--r-- | source/lib/system.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/source/lib/system.c b/source/lib/system.c index 24c726b8f75..bd7e4b8a67f 100644 --- a/source/lib/system.c +++ b/source/lib/system.c @@ -2242,3 +2242,28 @@ int sys_aio_suspend(const SMB_STRUCT_AIOCB * const cblist[], int n, const struct return -1; } #endif /* WITH_AIO */ + +int getpeereid( int s, uid_t *uid) +{ +#if defined(HAVE_PEERCRED) + struct ucred cred; + socklen_t cred_len = sizeof(struct ucred); + int ret; + + ret = getsockopt(s, SOL_SOCKET, SO_PEERCRED, (void *)&cred, &cred_len); + if (ret != 0) { + return -1; + } + + if (cred_len != sizeof(struct ucred)) { + errno = EINVAL; + return -1; + } + + *uid = cred.uid; + return 0; +#else + errno = ENOSYS; + return -1; +#endif +} |