{
HDEBUG(D_auth) debug_printf("heimdal: missing server_service\n");
return;
-}
+ }
-krc = krb5_init_context(&context);
-if (krc != 0)
+if ((krc = krb5_init_context(&context)))
{
int kerr = errno;
HDEBUG(D_auth) debug_printf("heimdal: failed to initialise krb5 context: %s\n",
{
k_keytab_typed_name = CCS string_sprintf("file:%s", expand_string(ob->server_keytab));
HDEBUG(D_auth) debug_printf("heimdal: using keytab %s\n", k_keytab_typed_name);
- krc = krb5_kt_resolve(context, k_keytab_typed_name, &keytab);
- if (krc)
+ if ((krc = krb5_kt_resolve(context, k_keytab_typed_name, &keytab)))
{
HDEBUG(D_auth) exim_heimdal_error_debug("krb5_kt_resolve", context, krc);
return;
else
{
HDEBUG(D_auth) debug_printf("heimdal: using system default keytab\n");
- krc = krb5_kt_default(context, &keytab);
- if (krc)
+ if ((krc = krb5_kt_default(context, &keytab)))
{
HDEBUG(D_auth) exim_heimdal_error_debug("krb5_kt_default", context, krc);
return;
HDEBUG(D_auth)
{
/* http://www.h5l.org/manual/HEAD/krb5/krb5_keytab_intro.html */
- krc = krb5_kt_start_seq_get(context, keytab, &cursor);
- if (krc)
+ if ((krc = krb5_kt_start_seq_get(context, keytab, &cursor)))
exim_heimdal_error_debug("krb5_kt_start_seq_get", context, krc);
else
{
- while ((krc = krb5_kt_next_entry(context, keytab, &entry, &cursor)) == 0)
+ while (!(krc = krb5_kt_next_entry(context, keytab, &entry, &cursor)))
{
principal = enctype_s = NULL;
krb5_unparse_name(context, entry.principal, &principal);
free(enctype_s);
krb5_kt_free_entry(context, &entry);
}
- krc = krb5_kt_end_seq_get(context, keytab, &cursor);
- if (krc)
+ if ((krc = krb5_kt_end_seq_get(context, keytab, &cursor)))
exim_heimdal_error_debug("krb5_kt_end_seq_get", context, krc);
}
}
-krc = krb5_kt_close(context, keytab);
-if (krc)
+if ((krc = krb5_kt_close(context, keytab)))
HDEBUG(D_auth) exim_heimdal_error_debug("krb5_kt_close", context, krc);
krb5_free_context(context);
switch (step)
{
case 0:
- if (!from_client || *from_client == '\0')
+ if (!from_client || !*from_client)
{
if (handled_empty_ir)
{
error_out = BAD64;
goto ERROR_OUT;
}
- else
- {
- HDEBUG(D_auth) debug_printf("gssapi: missing initial response, nudging.\n");
- error_out = auth_get_data(&from_client, US"", 0);
- if (error_out != OK)
- goto ERROR_OUT;
- handled_empty_ir = TRUE;
- continue;
- }
+
+ HDEBUG(D_auth) debug_printf("gssapi: missing initial response, nudging.\n");
+ error_out = auth_get_data(&from_client, US"", 0);
+ if (error_out != OK)
+ goto ERROR_OUT;
+ handled_empty_ir = TRUE;
+ continue;
}
/* We should now have the opening data from the client, base64-encoded. */
step += 1;
}
requested_qop = (CS gbufdesc_out.value)[0];
- if ((requested_qop & 0x01) == 0)
+ if (!(requested_qop & 0x01))
{
HDEBUG(D_auth)
debug_printf("gssapi: client requested security layers (%x)\n",
/* $auth1 is GSSAPI display name */
maj_stat = gss_display_name(&min_stat,
- gclient,
- &gbufdesc_out,
- &mech_type);
+ gclient, &gbufdesc_out, &mech_type);
if (GSS_ERROR(maj_stat))
{
auth_vars[1] = expand_nstring[2] = NULL;
#if defined(USE_DB) && defined(DB_VERSION_STRING)
void
-#if DB_VERSION_MAJOR > 4 || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 3)
+# if DB_VERSION_MAJOR > 4 || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 3)
dbfn_bdb_error_callback(const DB_ENV *dbenv, const char *pfx, const char *msg)
{
dbenv = dbenv;
-#else
+# else
dbfn_bdb_error_callback(const char *pfx, char *msg)
{
-#endif
+# endif
pfx = pfx;
printf("Berkeley DB error: %s\n", msg);
}
exit(1);
}
-if (Ustrcmp(argv[arg], "-") == 0) f = stdin; else
+if (Ustrcmp(argv[arg], "-") == 0)
+ f = stdin;
+else if (!(f = fopen(argv[arg], "rb")))
{
- f = fopen(argv[arg], "rb");
- if (f == NULL)
- {
- printf("exim_dbmbuild: unable to open %s: %s\n", argv[arg], strerror(errno));
- exit(1);
- }
+ printf("exim_dbmbuild: unable to open %s: %s\n", argv[arg], strerror(errno));
+ exit(1);
}
/* By default Berkeley db does not put extensions on... which
while (strncmpic(url, US"ldap", 4) != 0)
{
const uschar *name = url;
- while (*url != 0 && *url != '=') url++;
+ while (*url && *url != '=') url++;
if (*url == '=')
{
int namelen;
that is needed when the DN is used as a base DN in a query. Sigh. This is all
far too complicated. */
-if (user != NULL)
+if (user)
{
uschar *t = user;
for (uschar * s = user; *s != 0; s++)
DEBUG(D_lookup)
debug_printf_indent("LDAP parameters: user=%s pass=%s size=%d time=%d connect=%d "
"dereference=%d referrals=%s\n", user, password, sizelimit, timelimit,
- tcplimit, dereference, (referrals == LDAP_OPT_ON)? "on" : "off");
+ tcplimit, dereference, referrals == LDAP_OPT_ON ? "on" : "off");
/* If the request is just to check authentication, some credentials must
be given. The password must not be empty because LDAP binds with an empty
if (search_type == SEARCH_LDAP_AUTH)
{
- if (user == NULL || password == NULL)
+ if (!user || !password)
{
*errmsg = US"ldapauth lookups must specify the username and password";
return DEFER;
}
- if (password[0] == 0)
+ if (!*password)
{
DEBUG(D_lookup) debug_printf_indent("Empty password: ldapauth returns FAIL\n");
return FAIL;
/* No default servers, or URL contains a server name: just one attempt */
-if ((eldap_default_servers == NULL && local_servers == NULL) || p[3] != '/')
- {
+if (!eldap_default_servers && !local_servers || p[3] != '/')
return perform_ldap_search(url, NULL, 0, search_type, res, errmsg,
&defer_break, user, password, sizelimit, timelimit, tcplimit, dereference,
referrals);
- }
/* Loop through the default servers until OK or FAIL. Use local_servers list
* if defined in the lookup, otherwise use the global default list */
-list = (local_servers == NULL) ? eldap_default_servers : local_servers;
-while ((server = string_nextinlist(&list, &sep, buffer, sizeof(buffer))) != NULL)
+list = !local_servers ? eldap_default_servers : local_servers;
+while ((server = string_nextinlist(&list, &sep, buffer, sizeof(buffer))))
{
int rc;
int port = 0;
uschar *colon = Ustrchr(server, ':');
- if (colon != NULL)
+ if (colon)
{
*colon = 0;
port = Uatoi(colon+1);
if (Ufgets(big_buffer, big_buffer_size, fp) == NULL) goto SPOOL_READ_ERROR;
-{
-uschar *p = big_buffer + Ustrlen(big_buffer);
-while (p > big_buffer && isspace(p[-1])) p--;
-*p = 0;
-if (!isdigit(p[-1])) goto SPOOL_FORMAT_ERROR;
-while (p > big_buffer && (isdigit(p[-1]) || '-' == p[-1])) p--;
-gid = Uatoi(p);
-if (p <= big_buffer || *(--p) != ' ') goto SPOOL_FORMAT_ERROR;
-*p = 0;
-if (!isdigit(p[-1])) goto SPOOL_FORMAT_ERROR;
-while (p > big_buffer && (isdigit(p[-1]) || '-' == p[-1])) p--;
-uid = Uatoi(p);
-if (p <= big_buffer || *(--p) != ' ') goto SPOOL_FORMAT_ERROR;
-*p = 0;
-}
+ {
+ uschar *p = big_buffer + Ustrlen(big_buffer);
+ while (p > big_buffer && isspace(p[-1])) p--;
+ *p = 0;
+ if (!isdigit(p[-1])) goto SPOOL_FORMAT_ERROR;
+ while (p > big_buffer && (isdigit(p[-1]) || '-' == p[-1])) p--;
+ gid = Uatoi(p);
+ if (p <= big_buffer || *(--p) != ' ') goto SPOOL_FORMAT_ERROR;
+ *p = 0;
+ if (!isdigit(p[-1])) goto SPOOL_FORMAT_ERROR;
+ while (p > big_buffer && (isdigit(p[-1]) || '-' == p[-1])) p--;
+ uid = Uatoi(p);
+ if (p <= big_buffer || *(--p) != ' ') goto SPOOL_FORMAT_ERROR;
+ *p = 0;
+ }
originator_login = string_copy(big_buffer);
originator_uid = (uid_t)uid;