We don't want to translate debugging messages.

This commit is contained in:
Todd C. Miller
2011-05-17 18:37:18 -04:00
parent c3a259f5ee
commit 917c8d48ad
4 changed files with 50 additions and 54 deletions

View File

@@ -835,7 +835,7 @@ sudo_ldap_check_bool(LDAP *ld, LDAPMessage *entry, char *option)
/* walk through options */
for (p = bv; *p != NULL; p++) {
var = (*p)->bv_val;;
DPRINTF((_("ldap sudoOption: '%s'"), var), 2);
DPRINTF(("ldap sudoOption: '%s'", var), 2);
if ((ch = *var) == '!')
var++;
@@ -868,7 +868,7 @@ sudo_ldap_parse_options(LDAP *ld, LDAPMessage *entry)
/* walk through options */
for (p = bv; *p != NULL; p++) {
var = estrdup((*p)->bv_val);
DPRINTF((_("ldap sudoOption: '%s'"), var), 2);
DPRINTF(("ldap sudoOption: '%s'", var), 2);
/* check for equals sign past first char */
val = strchr(var, '=');
@@ -1349,11 +1349,11 @@ sudo_ldap_read_config(void)
value = ldap_conf.krb5_ccname +
(ldap_conf.krb5_ccname[4] == ':' ? 5 : 7);
if ((fp = fopen(value, "r")) != NULL) {
DPRINTF((_("using krb5 credential cache: %s"), value), 1);
DPRINTF(("using krb5 credential cache: %s", value), 1);
fclose(fp);
} else {
/* Can't open it, just ignore the entry. */
DPRINTF((_("unable to open krb5 credential cache: %s"), value), 1);
DPRINTF(("unable to open krb5 credential cache: %s", value), 1);
efree(ldap_conf.krb5_ccname);
ldap_conf.krb5_ccname = NULL;
}
@@ -1635,7 +1635,7 @@ sudo_ldap_display_privs(struct sudo_nss *nss, struct passwd *pw,
goto done;
ld = handle->ld;
DPRINTF((_("ldap search for command list")), 1);
DPRINTF(("ldap search for command list"), 1);
lres = sudo_ldap_result_get(nss, pw);
/* Display all matching entries. */
@@ -1668,7 +1668,7 @@ sudo_ldap_display_cmnd(struct sudo_nss *nss, struct passwd *pw)
* The sudo_ldap_result_get() function returns all nodes that match
* the user and the host.
*/
DPRINTF((_("ldap search for command list")), 1);
DPRINTF(("ldap search for command list"), 1);
lres = sudo_ldap_result_get(nss, pw);
for (i = 0; i < lres->nentries; i++) {
entry = lres->entries[i].entry;
@@ -1750,7 +1750,7 @@ sudo_ldap_set_options(LDAP *ld)
cur->conf_str, ival, ldap_err2string(rc));
return -1;
}
DPRINTF((_("ldap_set_option: %s -> %d"), cur->conf_str, ival), 1);
DPRINTF(("ldap_set_option: %s -> %d", cur->conf_str, ival), 1);
}
break;
case CONF_STR:
@@ -1762,7 +1762,7 @@ sudo_ldap_set_options(LDAP *ld)
cur->conf_str, sval, ldap_err2string(rc));
return -1;
}
DPRINTF((_("ldap_set_option: %s -> %s"), cur->conf_str, sval), 1);
DPRINTF(("ldap_set_option: %s -> %s", cur->conf_str, sval), 1);
}
break;
}
@@ -1908,7 +1908,7 @@ sudo_ldap_bind_s(LDAP *ld)
if (gss_krb5_ccache_name(&status, ldap_conf.krb5_ccname, &old_ccname)
!= GSS_S_COMPLETE) {
old_ccname = NULL;
DPRINTF((_("gss_krb5_ccache_name() failed: %d"), status), 1);
DPRINTF(("gss_krb5_ccache_name() failed: %d", status), 1);
}
# else
setenv("KRB5CCNAME", ldap_conf.krb5_ccname, TRUE);
@@ -1919,7 +1919,7 @@ sudo_ldap_bind_s(LDAP *ld)
if (ldap_conf.krb5_ccname != NULL) {
# ifdef HAVE_GSS_KRB5_CCACHE_NAME
if (gss_krb5_ccache_name(&status, old_ccname, NULL) != GSS_S_COMPLETE)
DPRINTF((_("gss_krb5_ccache_name() failed: %d"), status), 1);
DPRINTF(("gss_krb5_ccache_name() failed: %d", status), 1);
# else
if (old_ccname != NULL)
setenv("KRB5CCNAME", old_ccname, TRUE);
@@ -1932,7 +1932,7 @@ sudo_ldap_bind_s(LDAP *ld)
ldap_err2string(rc));
return -1;
}
DPRINTF((_("ldap_sasl_interactive_bind_s() ok")), 1);
DPRINTF(("ldap_sasl_interactive_bind_s() ok"), 1);
} else
#endif /* HAVE_LDAP_SASL_INTERACTIVE_BIND_S */
#ifdef HAVE_LDAP_SASL_BIND_S
@@ -1948,7 +1948,7 @@ sudo_ldap_bind_s(LDAP *ld)
warningx(_("ldap_sasl_bind_s(): %s"), ldap_err2string(rc));
return -1;
}
DPRINTF((_("ldap_sasl_bind_s() ok")), 1);
DPRINTF(("ldap_sasl_bind_s() ok"), 1);
}
#else
{
@@ -1957,7 +1957,7 @@ sudo_ldap_bind_s(LDAP *ld)
warningx(_("ldap_simple_bind_s(): %s"), ldap_err2string(rc));
return -1;
}
DPRINTF((_("ldap_simple_bind_s() ok")), 1);
DPRINTF(("ldap_simple_bind_s() ok"), 1);
}
#endif
return 0;
@@ -2012,7 +2012,7 @@ sudo_ldap_open(struct sudo_nss *nss)
warningx(_("ldap_start_tls_s(): %s"), ldap_err2string(rc));
return -1;
}
DPRINTF((_("ldap_start_tls_s() ok")), 1);
DPRINTF(("ldap_start_tls_s() ok"), 1);
#elif defined(HAVE_LDAP_SSL_CLIENT_INIT) && defined(HAVE_LDAP_START_TLS_S_NP)
if (ldap_ssl_client_init(NULL, NULL, 0, &rc) != LDAP_SUCCESS) {
warningx(_("ldap_ssl_client_init(): %s"), ldap_err2string(rc));
@@ -2023,7 +2023,7 @@ sudo_ldap_open(struct sudo_nss *nss)
warningx(_("ldap_start_tls_s_np(): %s",) ldap_err2string(rc));
return -1;
}
DPRINTF((_("ldap_start_tls_s_np() ok")), 1);
DPRINTF(("ldap_start_tls_s_np() ok"), 1);
#else
warningx(_("start_tls specified but LDAP libs do not support ldap_start_tls_s() or ldap_start_tls_s_np()"));
#endif /* !HAVE_LDAP_START_TLS_S && !HAVE_LDAP_START_TLS_S_NP */
@@ -2060,7 +2060,7 @@ sudo_ldap_setdefs(struct sudo_nss *nss)
ld = handle->ld;
filt = sudo_ldap_build_default_filter();
DPRINTF((_("Looking for cn=defaults: %s"), filt), 1);
DPRINTF(("Looking for cn=defaults: %s", filt), 1);
for (base = ldap_conf.base; base != NULL; base = base->next) {
if (ldap_conf.timeout > 0) {
@@ -2072,10 +2072,10 @@ sudo_ldap_setdefs(struct sudo_nss *nss)
rc = ldap_search_ext_s(ld, base->val, LDAP_SCOPE_SUBTREE,
filt, NULL, 0, NULL, NULL, NULL, 0, &result);
if (rc == LDAP_SUCCESS && (entry = ldap_first_entry(ld, result))) {
DPRINTF((_("found: %s"), ldap_get_dn(ld, entry)), 1);
DPRINTF(("found:%s", ldap_get_dn(ld, entry)), 1);
sudo_ldap_parse_options(ld, entry);
} else
DPRINTF((_("no default options found in %s"), base->val), 1);
DPRINTF(("no default options found in %s", base->val), 1);
if (result)
ldap_msgfree(result);
@@ -2109,7 +2109,7 @@ sudo_ldap_lookup(struct sudo_nss *nss, int ret, int pwflag)
* password is required, so the order of the entries doesn't matter.
*/
if (pwflag) {
DPRINTF((_("perform search for pwflag %d"), pwflag), 1);
DPRINTF(("perform search for pwflag %d", pwflag), 1);
int doauth = UNSPEC;
enum def_tuple pwcheck =
(pwflag == -1) ? never : sudo_defs_table[pwflag].sd_un.tuple;
@@ -2152,7 +2152,7 @@ sudo_ldap_lookup(struct sudo_nss *nss, int ret, int pwflag)
goto done;
}
DPRINTF((_("searching LDAP for sudoers entries")), 1);
DPRINTF(("searching LDAP for sudoers entries"), 1);
setenv_implied = FALSE;
for (i = 0; i < lres->nentries; i++) {
@@ -2162,10 +2162,10 @@ sudo_ldap_lookup(struct sudo_nss *nss, int ret, int pwflag)
rc = sudo_ldap_check_command(ld, entry, &setenv_implied);
if (rc != UNSPEC) {
/* We have a match. */
DPRINTF((rc == TRUE ? _("Command allowed") : _("Command not allowed")), 1);
DPRINTF(("Command %sallowed", rc == TRUE ? "" : "NOT "), 1);
matched = TRUE;
if (rc == TRUE) {
DPRINTF((_("LDAP entry: %p"), entry), 1);
DPRINTF(("LDAP entry: %p", entry), 1);
/* Apply entry-specific options. */
if (setenv_implied)
def_setenv = TRUE;
@@ -2188,7 +2188,7 @@ sudo_ldap_lookup(struct sudo_nss *nss, int ret, int pwflag)
}
done:
DPRINTF((_("done with LDAP searches")), 1);
DPRINTF(("done with LDAP searches"), 1);
DPRINTF(("user_matches=%d", lres->user_matches), 1);
DPRINTF(("host_matches=%d", lres->host_matches), 1);
@@ -2253,13 +2253,13 @@ sudo_ldap_result_add_entry(struct ldap_result *lres, LDAPMessage *entry)
if (bv != NULL) {
if (ldap_count_values_len(bv) > 0) {
/* Get the value of this attribute, 0 if not present. */
DPRINTF((_("order attribute raw: %s"), (*bv)->bv_val), 1);
DPRINTF(("order attribute raw: %s", (*bv)->bv_val), 1);
order = strtod((*bv)->bv_val, &ep);
if (ep == (*bv)->bv_val || *ep != '\0') {
warningx(_("invalid sudoOrder attribute: %s"), (*bv)->bv_val);
order = 0.0;
}
DPRINTF((_("order attribute: %f"), order), 1);
DPRINTF(("order attribute: %f", order), 1);
}
ldap_value_free_len(bv);
}
@@ -2290,7 +2290,7 @@ sudo_ldap_result_free_nss(struct sudo_nss *nss)
struct sudo_ldap_handle *handle = nss->handle;
if (handle->result != NULL) {
DPRINTF((_("freeing saved search result")), 1);
DPRINTF(("removing reusable search result"), 1);
sudo_ldap_result_free(handle->result);
if (handle->username) {
efree(handle->username);
@@ -2324,12 +2324,12 @@ sudo_ldap_result_get(struct sudo_nss *nss, struct passwd *pw)
if (handle->result) {
if (handle->groups == user_groups &&
strcmp(pw->pw_name, handle->username) == 0) {
DPRINTF((_("reusing previous result (user %s) with %d entries"),
DPRINTF(("reusing previous result (user %s) with %d entries",
handle->username, handle->result->nentries), 1);
return handle->result;
}
/* User mismatch, cached result cannot be used. */
DPRINTF((_("removing result (user %s), new search (user %s)"),
DPRINTF(("removing result (user %s), new search (user %s)",
handle->username, pw->pw_name), 1);
sudo_ldap_result_free_nss(nss);
}
@@ -2355,9 +2355,9 @@ sudo_ldap_result_get(struct sudo_nss *nss, struct passwd *pw)
lres = sudo_ldap_result_alloc();
for (do_netgr = 0; do_netgr < 2; do_netgr++) {
filt = do_netgr ? sudo_ldap_build_pass2() : sudo_ldap_build_pass1(pw);
DPRINTF((_("ldap search '%s'"), filt), 1);
DPRINTF(("ldap search '%s'", filt), 1);
for (base = ldap_conf.base; base != NULL; base = base->next) {
DPRINTF((_("searching from base '%s'"), base->val), 1);
DPRINTF(("searching from base '%s'", base->val), 1);
if (ldap_conf.timeout > 0) {
tv.tv_sec = ldap_conf.timeout;
tv.tv_usec = 0;
@@ -2367,13 +2367,13 @@ sudo_ldap_result_get(struct sudo_nss *nss, struct passwd *pw)
rc = ldap_search_ext_s(ld, base->val, LDAP_SCOPE_SUBTREE, filt,
NULL, 0, NULL, NULL, NULL, 0, &result);
if (rc != LDAP_SUCCESS) {
DPRINTF((_("nothing found for '%s'"), filt), 1);
DPRINTF(("nothing found for '%s'", filt), 1);
continue;
}
lres->user_matches = TRUE;
/* Add the seach result to list of search results. */
DPRINTF((_("adding search result")), 1);
DPRINTF(("adding search result"), 1);
sudo_ldap_result_add_search(lres, ld, result);
LDAP_FOREACH(entry, ld, result) {
if ((!do_netgr ||
@@ -2383,13 +2383,13 @@ sudo_ldap_result_get(struct sudo_nss *nss, struct passwd *pw)
sudo_ldap_result_add_entry(lres, entry);
}
}
DPRINTF((_("result now has %d entries"), lres->nentries), 1);
DPRINTF(("result now has %d entries", lres->nentries), 1);
}
efree(filt);
}
/* Sort the entries by the sudoOrder attribute. */
DPRINTF((_("sorting remaining %d entries"), lres->nentries), 1);
DPRINTF(("sorting remaining %d entries", lres->nentries), 1);
qsort(lres->entries, lres->nentries, sizeof(lres->entries[0]),
ldap_entry_compare);
@@ -2468,7 +2468,7 @@ sudo_ldap_result_from_search(LDAP *ldap, LDAPMessage *searchresult)
LDAP_FOREACH(entry, last->ldap, last->searchresult) {
sudo_ldap_result_add_entry(result, entry);
}
DPRINTF((_("sudo_ldap_result_from_search: %d entries found"),
DPRINTF(("sudo_ldap_result_from_search: %d entries found",
result->nentries), 2);
return result;
}