diff options
author | David Sommerseth <dazo@users.sourceforge.net> | 2009-10-13 14:25:50 +0200 |
---|---|---|
committer | David Sommerseth <dazo@users.sourceforge.net> | 2009-10-13 14:37:24 +0200 |
commit | c6621d108bb8beb97ca6185c0c11d4fbffab5a1b (patch) | |
tree | d3c68716c7e2dc8f2fc0f949d6305a28f4504d38 /plugin/eurephia.c | |
parent | 5501786363987737509c2306a9eba9af8d881817 (diff) | |
download | eurephia-c6621d108bb8beb97ca6185c0c11d4fbffab5a1b.tar.gz eurephia-c6621d108bb8beb97ca6185c0c11d4fbffab5a1b.tar.xz eurephia-c6621d108bb8beb97ca6185c0c11d4fbffab5a1b.zip |
Always process certificate depth as integer
Diffstat (limited to 'plugin/eurephia.c')
-rw-r--r-- | plugin/eurephia.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/plugin/eurephia.c b/plugin/eurephia.c index 544e0ec..deea91c 100644 --- a/plugin/eurephia.c +++ b/plugin/eurephia.c @@ -251,11 +251,12 @@ int eurephiaShutdown(eurephiaCTX *ctx) * * @return Returns 0 on failure and 1 on success. */ -int eurephia_tlsverify(eurephiaCTX *ctx, const char **env, const char *depth) +int eurephia_tlsverify(eurephiaCTX *ctx, const char **env, const char *depth_str) { int result = 0; char *ipaddr; char *tls_digest, *tls_id; + unsigned int depth = atoi_nullsafe(depth_str); certinfo *ci = NULL; DEBUG(ctx, 10, "** Function call: eurephia_tlsverify(...)"); @@ -274,7 +275,7 @@ int eurephia_tlsverify(eurephiaCTX *ctx, const char **env, const char *depth) } // Check if certificate digest is blacklisted - tls_digest = GETENV_TLSDIGEST(ctx, env, atoi_nullsafe(depth)); + tls_digest = GETENV_TLSDIGEST(ctx, env, depth); if( eDBblacklist_check(ctx, attempt_CERTIFICATE, tls_digest) == 1 ) { eDBregister_attempt(ctx, attempt_IPADDR, ATTEMPT_REGISTER, ipaddr); eDBregister_attempt(ctx, attempt_CERTIFICATE, ATTEMPT_REGISTER, tls_digest); @@ -284,7 +285,7 @@ int eurephia_tlsverify(eurephiaCTX *ctx, const char **env, const char *depth) } // Check if certificate is registered and allowed - tls_id = GETENV_TLSID(ctx, env, atoi_nullsafe(depth)); + tls_id = GETENV_TLSID(ctx, env, depth); ci = parse_tlsid(tls_id); result = eDBauth_TLS(ctx, ci->org, ci->common_name, ci->email, tls_digest, depth); if( result < 1 ) { @@ -299,7 +300,7 @@ int eurephia_tlsverify(eurephiaCTX *ctx, const char **env, const char *depth) result, ci->org, ci->common_name, ci->email); } else { eurephia_log(ctx, LOG_WARNING, 0, - "Unknown certificate for: %s/%s/%s (depth %s, digest: %s)", + "Unknown certificate for: %s/%s/%s (depth %i, digest: %s)", ci->org, ci->common_name, ci->email, depth, tls_digest); } free_nullsafe(ctx, tls_id); @@ -371,7 +372,7 @@ int eurephia_userauth(eurephiaCTX *ctx, const char **env) // Get certificate ID tls_id = GETENV_TLSID(ctx, env, 0); ci = parse_tlsid(tls_id); - certid = eDBauth_TLS(ctx, ci->org, ci->common_name, ci->email, tls_digest, "0"); + certid = eDBauth_TLS(ctx, ci->org, ci->common_name, ci->email, tls_digest, 0); if( certid < 1 ) { eDBregister_attempt(ctx, attempt_IPADDR, ATTEMPT_REGISTER, ipaddr); eDBregister_attempt(ctx, attempt_CERTIFICATE, ATTEMPT_REGISTER, tls_digest); @@ -518,7 +519,7 @@ int eurephia_connect(eurephiaCTX *ctx, const char **env) { eDBfree_session(ctx, session); return 0; } - certid = eDBauth_TLS(ctx, ci->org, ci->common_name, ci->email, digest, "0"); + certid = eDBauth_TLS(ctx, ci->org, ci->common_name, ci->email, digest, 0); uid = eDBget_uid(ctx, certid, uname); free_certinfo(ci); |