Drop the unused locks

This commit is contained in:
Jakub Jelen 2018-06-28 09:24:57 +02:00
parent 62f1736470
commit 191bbb979e

View File

@ -57,7 +57,7 @@ index a5a81ed2..63f877f2 100644
do_pam_putenv("KRB5CCNAME", authctxt->krb5_ccname); do_pam_putenv("KRB5CCNAME", authctxt->krb5_ccname);
#endif #endif
@@ -222,10 +223,59 @@ auth_krb5_password(Authctxt *authctxt, const char *password) @@ -222,11 +223,54 @@ auth_krb5_password(Authctxt *authctxt, const char *password)
void void
krb5_cleanup_proc(Authctxt *authctxt) krb5_cleanup_proc(Authctxt *authctxt)
{ {
@ -72,15 +72,12 @@ index a5a81ed2..63f877f2 100644
+ krb5_ccache ccache; + krb5_ccache ccache;
+ int ret; + int ret;
+ +
+ /* Avoid race conditions with other processes touching the same collection */
+ //krb5_cccol_lock(ctx);
+
+ krb5_cc_destroy(ctx, authctxt->krb5_fwd_ccache); + krb5_cc_destroy(ctx, authctxt->krb5_fwd_ccache);
authctxt->krb5_fwd_ccache = NULL; authctxt->krb5_fwd_ccache = NULL;
+ +
+ ret = krb5_cccol_cursor_new(ctx, &cursor); + ret = krb5_cccol_cursor_new(ctx, &cursor);
+ if (ret) + if (ret)
+ goto unlock; + goto out;
+ +
+ ret = krb5_cccol_cursor_next(ctx, cursor, &ccache); + ret = krb5_cccol_cursor_next(ctx, cursor, &ccache);
+ if (ret == 0 && ccache != NULL) { + if (ret == 0 && ccache != NULL) {
@ -110,14 +107,12 @@ index a5a81ed2..63f877f2 100644
+ } + }
+ } + }
+ } + }
+unlock:
+ krb5_cccol_cursor_free(ctx, &cursor); + krb5_cccol_cursor_free(ctx, &cursor);
+
+ /* Release lock */
+ //krb5_cccol_unlock(ctx);
} }
+out:
if (authctxt->krb5_user) { if (authctxt->krb5_user) {
krb5_free_principal(authctxt->krb5_ctx, authctxt->krb5_user); krb5_free_principal(authctxt->krb5_ctx, authctxt->krb5_user);
authctxt->krb5_user = NULL;
@@ -237,36 +287,186 @@ krb5_cleanup_proc(Authctxt *authctxt) @@ -237,36 +287,186 @@ krb5_cleanup_proc(Authctxt *authctxt)
} }
} }