summaryrefslogtreecommitdiff
path: root/source3/smbd/password.c
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2010-05-31 10:36:02 -0400
committerAndreas Schneider <asn@samba.org>2010-05-31 18:21:29 +0200
commitb32b59d47f8ec597be9d215e5e260e5d1411d3a4 (patch)
treee987a627a96749a7fc8c8086bc3ebe328c379f95 /source3/smbd/password.c
parent1da415345971fbd045808d26142b9eca797aaedf (diff)
downloadsamba-b32b59d47f8ec597be9d215e5e260e5d1411d3a4.tar.gz
samba-b32b59d47f8ec597be9d215e5e260e5d1411d3a4.tar.bz2
samba-b32b59d47f8ec597be9d215e5e260e5d1411d3a4.zip
s3:smbd make yp cache local.
The my_yp_domain variable is just a static cache needed to avoid making over and over expensive and potentially blocking calls to yp_get_default_domain(). Instead of keeping this onto the smbd_server_connection struct, just keep it local to the only function ever using this variable. This disentagle this function (and a number of calling functions) from having to pass around smbd_server_connection and thus having to link against smbd. It also removes a few ifdefs. Nothing changes from a global/local pov, as the smbd_server_connection variable passed around is also a global one. Signed-off-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'source3/smbd/password.c')
-rw-r--r--source3/smbd/password.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/source3/smbd/password.c b/source3/smbd/password.c
index 809a913d6c..7101f7c8c4 100644
--- a/source3/smbd/password.c
+++ b/source3/smbd/password.c
@@ -412,24 +412,22 @@ bool user_in_netgroup(struct smbd_server_connection *sconn,
const char *user, const char *ngname)
{
#ifdef HAVE_NETGROUP
+ static char *my_yp_domain = NULL;
fstring lowercase_user;
- if (sconn->smb1.sessions.my_yp_domain == NULL) {
- yp_get_default_domain(&sconn->smb1.sessions.my_yp_domain);
+ if (my_yp_domain == NULL) {
+ yp_get_default_domain(&my_yp_domain);
}
- if (sconn->smb1.sessions.my_yp_domain == NULL) {
+ if (my_yp_domain == NULL) {
DEBUG(5,("Unable to get default yp domain, "
"let's try without specifying it\n"));
}
DEBUG(5,("looking for user %s of domain %s in netgroup %s\n",
- user,
- sconn->smb1.sessions.my_yp_domain?
- sconn->smb1.sessions.my_yp_domain:"(ANY)",
- ngname));
+ user, my_yp_domain?my_yp_domain:"(ANY)", ngname));
- if (innetgr(ngname, NULL, user, sconn->smb1.sessions.my_yp_domain)) {
+ if (innetgr(ngname, NULL, user, my_yp_domain)) {
DEBUG(5,("user_in_netgroup: Found\n"));
return true;
}
@@ -447,13 +445,9 @@ bool user_in_netgroup(struct smbd_server_connection *sconn,
}
DEBUG(5,("looking for user %s of domain %s in netgroup %s\n",
- lowercase_user,
- sconn->smb1.sessions.my_yp_domain?
- sconn->smb1.sessions.my_yp_domain:"(ANY)",
- ngname));
+ lowercase_user, my_yp_domain?my_yp_domain:"(ANY)", ngname));
- if (innetgr(ngname, NULL, lowercase_user,
- sconn->smb1.sessions.my_yp_domain)) {
+ if (innetgr(ngname, NULL, lowercase_user, my_yp_domain)) {
DEBUG(5,("user_in_netgroup: Found\n"));
return true;
}