Permalink
Browse files

auth_succeeded: don't update smbpasswd if the name was cached anyway.

Since the username/password obviously haven't changed, there's no point in
updating smbpasswd.  This was making our "accelerated" mode not so
accelerated if you used the --smbpasswd option.
  • Loading branch information...
1 parent 4622cc5 commit fbe4744024b532a7e11d9667a27a57a525d4cfc8 @apenwarr committed Sep 3, 2009
Showing with 7 additions and 4 deletions.
  1. +7 −4 jfauthd.cc
View
@@ -287,9 +287,10 @@ class ForwardAuth : public AuthBase
};
-static void auth_succeeded(WvStringParm user, WvStringParm pass)
+static void auth_succeeded(WvStringParm user, WvStringParm pass,
+ bool was_cached)
{
- if (do_smbpasswd && !!user && !!pass)
+ if (!was_cached && do_smbpasswd && !!user && !!pass)
{
const char *argv[] = { "smbpasswd", "-a", "-s", user, NULL };
WvPipe p("smbpasswd", argv, true, false, false);
@@ -359,14 +360,16 @@ class AuthStream : public WvStreamClone
assert(globalauth);
WvError e;
- if (!authcache_check(user, pass, cache_accel_secs))
+ bool cache_result
+ = authcache_check(user, pass, cache_accel_secs);
+ if (!cache_result)
e = globalauth->check(*src(), user, pass);
if (e.isok())
{
log(WvLog::Info,
"PASS: auth succeeded for user '%s'\n", user);
- auth_succeeded(user, pass);
+ auth_succeeded(user, pass, cache_result);
}
else
log(WvLog::Notice,

0 comments on commit fbe4744

Please sign in to comment.