From 917c8d48ad1a747cf35c4acc9fa006a5f23173d6 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Tue, 17 May 2011 18:37:18 -0400 Subject: [PATCH] We don't want to translate debugging messages. --- plugins/sudoers/ldap.c | 70 +++++++++++++++++++++--------------------- src/exec.c | 10 +++--- src/exec_pty.c | 22 ++++++------- src/sudo.c | 2 +- 4 files changed, 50 insertions(+), 54 deletions(-) diff --git a/plugins/sudoers/ldap.c b/plugins/sudoers/ldap.c index 33eaf7b5c..3e7a65664 100644 --- a/plugins/sudoers/ldap.c +++ b/plugins/sudoers/ldap.c @@ -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; } diff --git a/src/exec.c b/src/exec.c index 31af84172..474fcc0f2 100644 --- a/src/exec.c +++ b/src/exec.c @@ -234,7 +234,7 @@ sudo_execve(struct command_details *details, struct command_status *cstat) if (!ISSET(details->flags, CD_BACKGROUND)) { if (ISSET(details->flags, CD_SET_UTMP)) utmp_user = details->utmp_user ? details->utmp_user : user_details.username; - sudo_debug(8, _("allocate pty for I/O logging")); + sudo_debug(8, "allocate pty for I/O logging"); pty_setup(details->euid, user_details.tty, utmp_user); } } @@ -354,7 +354,7 @@ sudo_execve(struct command_details *details, struct command_status *cstat) if (cstat->type == CMD_WSTATUS) { if (WIFSTOPPED(cstat->val)) { /* Suspend parent and tell child how to resume on return. */ - sudo_debug(8, _("child stopped, suspending parent")); + sudo_debug(8, "child stopped, suspending parent"); n = suspend_parent(WSTOPSIG(cstat->val)); schedule_signal(n); continue; @@ -426,12 +426,12 @@ handle_signals(int fd, pid_t child, int log_io, struct command_status *cstat) /* If pipe is empty, we are done. */ if (errno == EAGAIN) break; - sudo_debug(9, _("error reading signal pipe %s"), strerror(errno)); + sudo_debug(9, "error reading signal pipe %s", strerror(errno)); cstat->type = CMD_ERRNO; cstat->val = errno; return -1; } - sudo_debug(9, _("received signal %d"), signo); + sudo_debug(9, "received signal %d", signo); if (signo == SIGCHLD) { /* * If logging I/O, child is the intermediate process, @@ -496,7 +496,7 @@ forward_signals(int sock) while (!tq_empty(&sigfwd_list)) { sigfwd = tq_first(&sigfwd_list); - sudo_debug(9, _("sending signal %d to child over backchannel"), + sudo_debug(9, "sending signal %d to child over backchannel", sigfwd->signo); cstat.type = CMD_SIGNO; cstat.val = sigfwd->signo; diff --git a/src/exec_pty.c b/src/exec_pty.c index ecc57c30e..a5da51ffd 100644 --- a/src/exec_pty.c +++ b/src/exec_pty.c @@ -321,7 +321,7 @@ suspend_parent(int signo) /* Suspend self and continue child when we resume. */ sa.sa_handler = SIG_DFL; sigaction(signo, &sa, &osa); - sudo_debug(8, _("kill parent %d"), signo); + sudo_debug(8, "kill parent %d", signo); if (killpg(ppgrp, signo) != 0) warning("killpg(%d, %d)", ppgrp, signo); @@ -332,9 +332,8 @@ suspend_parent(int signo) * Only modify term if we are foreground process and either * the old tty mode was not cooked or child got SIGTT{IN,OU} */ - sudo_debug(8, - foreground ? _("parent is in foreground, ttymode %d -> %d") : - _("parent is in background, ttymode %d -> %d"), oldmode, ttymode); + sudo_debug(8, "parent is in %s, ttymode %d -> %d", + foreground ? "foreground" : "background", oldmode, ttymode); if (ttymode != TERM_COOKED) { if (foreground) { @@ -699,7 +698,7 @@ deliver_signal(pid_t pid, int signo) int status; /* Handle signal from parent. */ - sudo_debug(8, _("signal %d from parent"), signo); + sudo_debug(8, "signal %d from parent", signo); switch (signo) { case SIGALRM: terminate_child(pid, TRUE); @@ -742,10 +741,10 @@ send_status(int fd, struct command_status *cstat) n = send(fd, cstat, sizeof(*cstat), 0); } while (n == -1 && errno == EINTR); if (n != sizeof(*cstat)) { - sudo_debug(8, _("unable to send status to parent: %s"), + sudo_debug(8, "unable to send status to parent: %s", strerror(errno)); } else { - sudo_debug(8, _("sent status to parent")); + sudo_debug(8, "sent status to parent"); } cstat->type = CMD_INVALID; /* prevent re-sending */ } @@ -773,19 +772,16 @@ handle_sigchld(int backchannel, struct command_status *cstat) cstat->type = CMD_WSTATUS; cstat->val = status; if (WIFSTOPPED(status)) { - sudo_debug(8, _("command stopped, signal %d"), - WSTOPSIG(status)); + sudo_debug(8, "command stopped, signal %d", WSTOPSIG(status)); do { child_pgrp = tcgetpgrp(io_fds[SFD_SLAVE]); } while (child_pgrp == -1 && errno == EINTR); if (send_status(backchannel, cstat) == -1) return alive; /* XXX */ } else if (WIFSIGNALED(status)) { - sudo_debug(8, _("command killed, signal %d"), - WTERMSIG(status)); + sudo_debug(8, "command killed, signal %d", WTERMSIG(status)); } else { - sudo_debug(8, _("command exited: %d"), - WEXITSTATUS(status)); + sudo_debug(8, "command exited: %d", WEXITSTATUS(status)); } } if (!WIFSTOPPED(status)) diff --git a/src/sudo.c b/src/sudo.c index e3100670b..4b42652cf 100644 --- a/src/sudo.c +++ b/src/sudo.c @@ -1203,7 +1203,7 @@ sudo_debug(int level, const char *fmt, ...) return; /* Backet fmt with program name and a newline to make it a single write */ - easprintf(&fmt2, _("%s: %s\n"), getprogname(), fmt); + easprintf(&fmt2, "%s: %s\n", getprogname(), fmt); va_start(ap, fmt); vfprintf(stderr, fmt2, ap); va_end(ap); -- 2.40.0