OSDN Git Service

commited.
authorTaizo ITO <taizo@karesansui-project.info>
Fri, 7 Aug 2009 03:05:34 +0000 (12:05 +0900)
committerTaizo ITO <taizo@karesansui-project.info>
Fri, 7 Aug 2009 03:05:34 +0000 (12:05 +0900)
sample/pam_smtpauth.conf
src/pam_smtpauth.c
src/smtpauth.c
src/socket.c

index fbaf6a9..057ea1e 100644 (file)
@@ -16,3 +16,7 @@ SSLCertificateFile = /usr/share/ssl/certs/ca-bundle.crt
 # BlockedUserListFile specifies the path of a file that the unacceptable
 # users is written.
 #BlockedUserListFile = /etc/pam_smtpauth.blockedusers
+
+# DebugLevel specifies the debugging output level.
+# This  parameter is available if it was configured with --enable-debug=yes
+#DebugLevel = 0
index 16c5e7b..377acb5 100644 (file)
@@ -82,7 +82,7 @@ log_debug(int level, const char *fmt, ...) {
   va_end(msg);
 
   buf[sizeof(buf) - 1] = '\0';
-  syslog(LOG_DEBUG, buf);
+  syslog(LOG_MAIL|LOG_DEBUG, "[pam_smtpauth] %s", buf);
 }
 
 PAM_EXTERN int
@@ -109,7 +109,7 @@ pam_sm_authenticate( pam_handle_t *pamh, int flags, int argc, const char **argv)
       Get configuration file name
      */
 #ifdef DEBUG
-    log_debug(DEBUG_1, "pam_smtpauth: pam_sm_authenticate()");
+    log_debug(DEBUG_1, "pam_sm_authenticate() start");
 #endif
     if(argc == 0) {
         if((fd = open(SMTPAUTH_CONF, O_RDONLY)) != -1) {
@@ -125,7 +125,7 @@ pam_sm_authenticate( pam_handle_t *pamh, int flags, int argc, const char **argv)
             strcpy(configfile, strtok(NULL, "="));
         }
         else {
-            syslog(LOG_ERR, "pam_smtpauth: invalid module parameter.");
+            syslog(LOG_ERR, "[pam_smtpauth] invalid module parameter.");
         }
     }
 
@@ -139,11 +139,11 @@ pam_sm_authenticate( pam_handle_t *pamh, int flags, int argc, const char **argv)
      */
     result = pam_get_user(pamh, &username, NULL);
     if(result != PAM_SUCCESS || username == NULL) {
-        syslog(LOG_ERR, "pam_smtpauth: no user specified.");
+        syslog(LOG_ERR, "[pam_smtpauth] no user specified.");
         return PAM_USER_UNKNOWN;
     }
 #ifdef DEBUG
-    log_debug(DEBUG_1, "pam_smtpauth: username=%s", username);
+    log_debug(DEBUG_1, "username=%s", username);
 #endif
 
     if((blockedfile = get_config(configfile, "BlockedUserListFile")) != NULL) {
@@ -169,7 +169,7 @@ pam_sm_authenticate( pam_handle_t *pamh, int flags, int argc, const char **argv)
                     regfree(&reg);
                     if(regsuccess == 0) {
 #ifdef DEBUG
-                        log_debug(DEBUG_1, "pam_smtpauth: rejected username='%s' regex='%s'", username, line);
+                        log_debug(DEBUG_1, "rejected username='%s' regex='%s'", username, line);
 #endif
                         return PAM_AUTH_ERR;
                     }
@@ -183,7 +183,7 @@ pam_sm_authenticate( pam_handle_t *pamh, int flags, int argc, const char **argv)
      */
     if(password != NULL) {
 #ifdef DEBUG
-        log_debug(DEBUG_5, "pam_smtpauth: password is not NULL.");
+        log_debug(DEBUG_5, "password is not NULL.");
 #endif
         pam_set_item(pamh, PAM_AUTHTOK, (const void**)&password);
     }
@@ -193,15 +193,21 @@ pam_sm_authenticate( pam_handle_t *pamh, int flags, int argc, const char **argv)
     }
     result = pam_get_item(pamh, PAM_AUTHTOK, (const void **)&password);
     if(password == NULL) {
-        syslog(LOG_ERR, "pam_smtpauth: password is NULL.");
+        syslog(LOG_ERR, "[pam_smtpauth] password is NULL.");
+#ifdef DEBUG
+        log_debug(DEBUG_1, "password is NULL.");
+#endif
         return PAM_AUTHINFO_UNAVAIL;
     }
     if(strcmp(password, "") == 0) {
-        syslog(LOG_ERR, "pam_smtpauth: password is empty.");
+        syslog(LOG_ERR, "[pam_smtpauth] password is empty.");
+#ifdef DEBUG
+        log_debug(DEBUG_1, "password is empty.");
+#endif
         return PAM_AUTH_ERR;
     }
 #ifdef DEBUG
-    log_debug(DEBUG_9, "pam_smtpauth: password=%s", password);
+    log_debug(DEBUG_9, "password=%s", password);
 #endif
 
     if(!global.username) {
@@ -229,18 +235,18 @@ pam_sm_authenticate( pam_handle_t *pamh, int flags, int argc, const char **argv)
     }
     global.conn_timeout = conn_timeout;
 #ifdef DEBUG
-    log_debug(DEBUG_5, "pam_smtpauth: timeout: %d",timeout);
-    log_debug(DEBUG_5, "pam_smtpauth: conn_timeout: %d",conn_timeout);
+    log_debug(DEBUG_5, "timeout: %d",timeout);
+    log_debug(DEBUG_5, "conn_timeout: %d",conn_timeout);
 #endif
 
     for(cnt=0;;cnt++) {
         result = smtp_connect(cnt);
 #ifdef DEBUG
-        log_debug(DEBUG_5, "pam_smtpauth: smtp_connect cnt=%d result=%d", cnt, result);
+        log_debug(DEBUG_5, "smtp_connect cnt=%d result=%d", cnt, result);
 #endif
         if(result == SA_NO_SERVER_LEFT) {
 #ifdef DEBUG
-            log_debug(DEBUG_5, "pam_smtpauth: auth service cannot retrieve information.");
+            log_debug(DEBUG_5, "auth service cannot retrieve information.");
 #endif
             password = NULL;
             global.password = NULL;
@@ -254,7 +260,10 @@ pam_sm_authenticate( pam_handle_t *pamh, int flags, int argc, const char **argv)
             global.password = NULL;
             return PAM_AUTH_ERR;
         } else if(result == PAM_AUTH_ERR) {
-            syslog(LOG_ERR, "pam_smtpauth: authentication error cnt=%d.", cnt);
+            syslog(LOG_ERR, "[pam_smtpauth] authentication error cnt=%d.", cnt);
+#ifdef DEBUG
+            log_debug(DEBUG_5, "authentication error cnt=%d.", cnt);
+#endif
             password = NULL;
             global.password = NULL;
             return PAM_AUTH_ERR;
@@ -279,7 +288,7 @@ smtp_connect(int num) {
     struct servent *se;
 
 #ifdef DEBUG
-    log_debug(DEBUG_5, "pam_smtpauth: smtp_connect num=%d", num);
+    log_debug(DEBUG_5, "smtp_connect num=%d", num);
 #endif
 
     strcpy(param, "SMTPServer_");
@@ -287,7 +296,7 @@ smtp_connect(int num) {
     strcat(param, tnum);
     smtp_server = get_config(configfile, param);
 #ifdef DEBUG
-    log_debug(DEBUG_1, "pam_smtpauth: smtp_server=%s", smtp_server);
+    log_debug(DEBUG_1, "smtp_server=%s", smtp_server);
 #endif
 
     if(smtp_server == NULL) {
@@ -296,7 +305,9 @@ smtp_connect(int num) {
 
     if((strstr(smtp_server, "smtps:")) != NULL) {
 #ifdef USE_SSL
-        syslog(LOG_INFO, "pam_smtpauth: via smtps.");
+#ifdef DEBUG
+        log_debug(DEBUG_1, "use smtps");
+#endif
         global.use_smtps = 1;
         global.require_ssl = 1;
         global.use_sslv2 = 1;
@@ -304,7 +315,7 @@ smtp_connect(int num) {
         global.use_tlsv1 = 1;
         global.certfile = get_config(configfile, "SSLCertificateFile");
 #else
-        syslog(LOG_INFO, "pam_smtpauth: smtps is not implemented.");
+        syslog(LOG_INFO, "[pam_smtpauth] smtps is not implemented.");
 #endif
         strtok(smtp_server, ":");
         buffer = strtok(NULL, ":");
@@ -323,32 +334,44 @@ smtp_connect(int num) {
     }
 
 #ifdef DEBUG
-    log_debug(DEBUG_5, "pam_smtpauth: global.host=%s", global.host);
-    log_debug(DEBUG_5, "pam_smtpauth: global.port=%d", global.port);
-    log_debug(DEBUG_5, "pam_smtpauth: global.username=%s", global.username);
-    log_debug(DEBUG_9, "pam_smtpauth: global.password=%s", global.password);
+    log_debug(DEBUG_5, "global.host=%s", global.host);
+    log_debug(DEBUG_5, "global.port=%d", global.port);
+    log_debug(DEBUG_5, "global.username=%s", global.username);
+    log_debug(DEBUG_9, "global.password=%s", global.password);
 #endif
 
     smtp = (smtp_t *)smtp_auth(&global);
 #ifdef DEBUG
-    log_debug(DEBUG_5, "pam_smtpauth: smtp->error=%d", smtp->error);
+    log_debug(DEBUG_5, "smtp->error=%d", smtp->error);
 #endif
 
     //sleep(3);
     if(smtp == 0) {
-        syslog(LOG_ERR, "pam_smtpauth: mail_status -> FAIL");
+        syslog(LOG_ERR, "[pam_smtpauth] mail_status -> FAIL");
+#ifdef DEBUG
+        log_debug(DEBUG_1, "mail_status -> FAIL");
+#endif
         return PAM_AUTH_ERR;
     }
     else if(smtp->error == 1) {
-        syslog(LOG_WARNING, "pam_smtpauth: SERVER connection failure: %s:%d => %s", global.host, global.port, smtp->error_message);
+        syslog(LOG_WARNING, "[pam_smtpauth] SERVER connection failure: %s:%d => %s", global.host, global.port, smtp->error_message);
+#ifdef DEBUG
+        log_debug(DEBUG_1, "SERVER connection failure: %s:%d => %s", global.host, global.port, smtp->error_message);
+#endif
         return SA_SERVER_CONNECT_FAILURE;
     }
     else if(smtp->error == 2) {
-        syslog(LOG_ERR, "pam_smtpauth: LOGIN FAILURE user %s on %s:%d => %s", global.username, global.host, global.port, smtp->error_message);
+        syslog(LOG_ERR, "[pam_smtpauth] LOGIN FAILURE user %s on %s:%d => %s", global.username, global.host, global.port, smtp->error_message);
+#ifdef DEBUG
+        log_debug(DEBUG_1, "LOGIN FAILURE user %s on %s:%d => %s", global.username, global.host, global.port, smtp->error_message);
+#endif
         return SA_SERVER_LOGIN_FAILURE;
     }
     else if(smtp->error == 0) {
-        syslog(LOG_INFO, "pam_smtpauth: mail_status -> OK for %s", global.username);
+        syslog(LOG_INFO, "[pam_smtpauth] mail_status -> OK for %s", global.username);
+#ifdef DEBUG
+        log_debug(DEBUG_1, "mail_status -> OK for %s", global.username);
+#endif
         return PAM_SUCCESS;
     }
     else {
@@ -369,12 +392,12 @@ converse(pam_handle_t *pamh, int nargs, struct pam_message **msg, struct pam_res
         result = conv->conv(nargs, (const struct pam_message **)msg, resp, conv->appdata_ptr);
         if((result != PAM_SUCCESS) && (result != PAM_CONV_AGAIN)) {
 #ifdef DEBUG
-            log_debug(DEBUG_5, "pam_smtpauth: conversation failure [%s]", pam_strerror(pamh, result));
+            log_debug(DEBUG_5, "conversation failure [%s]", pam_strerror(pamh, result));
 #endif
         }
     }
     else {
-        syslog(LOG_ERR, "pam_smtpauth: couldn't obtain coversation function [%s]", pam_strerror(pamh, result));
+        syslog(LOG_ERR, "[pam_smtpauth] couldn't obtain coversation function [%s]", pam_strerror(pamh, result));
     }
     return result;
 }
@@ -459,7 +482,7 @@ PAM_EXTERN int pam_sm_acct_mgmt(pam_handle_t * pamh,
         int argc,
         const char **argv)
 {
-        syslog(LOG_INFO, "pam_smtpauth: acct_mgmt called but not implemented.");
+        syslog(LOG_INFO, "[pam_smtpauth] acct_mgmt called but not implemented.");
         return PAM_SUCCESS;
 }
 
@@ -469,7 +492,7 @@ int pam_sm_setcred(pam_handle_t *pamh,
         int argc,
         const char **argv)
 {
-        syslog(LOG_INFO, "pam_smtpauth: setcred called but not implemented.");
+        syslog(LOG_INFO, "[pam_smtpauth] setcred called but not implemented.");
         return PAM_SUCCESS;
 }
 
@@ -478,7 +501,7 @@ PAM_EXTERN
 int pam_sm_chauthtok(pam_handle_t *pamh,int flags,int argc
 ,const char **argv)
 {
-        syslog(LOG_INFO, "pam_smtpauth: chauthtok called but not implemented.  \
+        syslog(LOG_INFO, "[pam_smtpauth] chauthtok called but not implemented.  \
                 Password NOT CHANGED!");
         return PAM_SUCCESS;
 }
@@ -490,7 +513,7 @@ int pam_sm_open_session(pam_handle_t *pamh,
         int argc,
         const char **argv)
 {
-        syslog(LOG_INFO, "pam_smtpauth: open_session called but not implemented.");
+        syslog(LOG_INFO, "[pam_smtpauth] open_session called but not implemented.");
         return PAM_SUCCESS;
 }
 
@@ -500,7 +523,7 @@ int pam_sm_close_session(pam_handle_t *pamh,
         int argc,
         const char **argv)
 {
-        syslog(LOG_INFO, "pam_smtpauth: close_session called but not implemented.");
+        syslog(LOG_INFO, "[pam_smtpauth] close_session called but not implemented.");
         return PAM_SUCCESS;
 }
 
index 6f3807f..5c2af82 100644 (file)
@@ -26,7 +26,6 @@
 #include <ctype.h>
 #include <assert.h>
 #include <errno.h>
-#include <syslog.h>
 #include <time.h>
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -202,7 +201,7 @@ extract_token(const char *str, const char *token, char *value, int len) {
         }
     }
 #ifdef DEBUG
-    log_debug(DEBUG_9, "pam_smtpauth(smtpauth): str=%s", str);
+    log_debug(DEBUG_9, "extract_token: str=%s", str);
 #endif
 
     return 0;
@@ -225,7 +224,7 @@ digest_md5(char *response, unsigned char *text, unsigned int text_len, const cha
 
 
 #ifdef DEBUG
-    log_debug(DEBUG_9, "pam_smtpauth(smtpauth): text=%s", text);
+    log_debug(DEBUG_9, "digest_md5: text=%s", text);
 #endif
 
     extract_token((const char *)text, "nonce=", nonce, DIGEST_MD5_NONCE_LEN);
@@ -239,11 +238,11 @@ digest_md5(char *response, unsigned char *text, unsigned int text_len, const cha
 
     sprintf(uri, "smtp/%s", realm);
 #ifdef DEBUG
-    log_debug(DEBUG_9, "pam_smtpauth(smtpauth): realm=%s", realm);
-    log_debug(DEBUG_9, "pam_smtpauth(smtpauth): nonce=%s", nonce);
-    log_debug(DEBUG_9, "pam_smtpauth(smtpauth): qop=%s", qop);
-    log_debug(DEBUG_9, "pam_smtpauth(smtpauth): cnonce=%s", cnonce);
-    log_debug(DEBUG_9, "pam_smtpauth(smtpauth): uri=%s", uri);
+    log_debug(DEBUG_9, "digest_md5: realm=%s", realm);
+    log_debug(DEBUG_9, "digest_md5: nonce=%s", nonce);
+    log_debug(DEBUG_9, "digest_md5: qop=%s", qop);
+    log_debug(DEBUG_9, "digest_md5: cnonce=%s", cnonce);
+    log_debug(DEBUG_9, "digest_md5: uri=%s", uri);
 #endif
 
     /* A1 */
@@ -285,7 +284,7 @@ digest_md5(char *response, unsigned char *text, unsigned int text_len, const cha
     make_digest(hexA1, digest);
 
 #ifdef DEBUG
-    log_debug(DEBUG_9, "pam_smtpauth(smtpauth): A1=%s", hexA1);
+    log_debug(DEBUG_9, "digest_md5: A1=%s", hexA1);
 #endif
 
     /* A2 */
@@ -309,7 +308,7 @@ digest_md5(char *response, unsigned char *text, unsigned int text_len, const cha
     make_digest(hexA2, digest);
 
 #ifdef DEBUG
-    log_debug(DEBUG_9, "pam_smtpauth(smtpauth): A2=%s", hexA2);
+    log_debug(DEBUG_9, "digest_md5: A2=%s", hexA2);
 #endif
 
     /* response */
@@ -342,7 +341,7 @@ digest_md5(char *response, unsigned char *text, unsigned int text_len, const cha
     make_digest(resp, digest);
 
 #ifdef DEBUG
-    log_debug(DEBUG_9, "pam_smtpauth(smtpauth): resp=%s", resp);
+    log_debug(DEBUG_9, "digest_md5: resp=%s", resp);
 #endif
 
     sprintf(response, "charset=utf-8,username=\"%s\",realm=\"%s\",nonce=\"%s\","
@@ -351,8 +350,8 @@ digest_md5(char *response, unsigned char *text, unsigned int text_len, const cha
                login, realm, nonce, cnonce, uri, qop, resp);
 
 #ifdef DEBUG
-    log_debug(DEBUG_9, "pam_smtpauth(smtpauth): response:%s", response);
-    log_debug(DEBUG_9, "pam_smtpauth(smtpauth): text:%s", text);
+    log_debug(DEBUG_9, "digest_md5: response:%s", response);
+    log_debug(DEBUG_9, "digest_md5: text:%s", text);
 #endif
 }
 
@@ -444,9 +443,9 @@ smtp_auth(config_t *cfg) {
                             memset((char*)&taddr, 0, sizeof(taddr));
                             memcpy((char*)&taddr.sin_addr, he->h_addr_list[n], he->h_length);
 #ifdef DEBUG
-                            log_debug(DEBUG_5, "pam_smtpauth(smtpauth): my ip: %s",
+                            log_debug(DEBUG_5, "smtp_auth: my ip: %s",
                               inet_ntoa(((struct sockaddr_in *)&ifreq.ifr_addr)->sin_addr));
-                            log_debug(DEBUG_5, "pam_smtpauth(smtpauth): smtp ip: %s",
+                            log_debug(DEBUG_5, "smtp_auth: smtp ip: %s",
                               inet_ntoa(taddr.sin_addr));
 #endif
                             if(((struct sockaddr_in *)&ifreq.ifr_addr)->sin_addr.s_addr == taddr.sin_addr.s_addr) {
@@ -473,7 +472,7 @@ smtp_auth(config_t *cfg) {
     }
     if(connect(s, (struct sockaddr *) &addr, sizeof(addr))) {
 #ifdef DEBUG
-        log_debug(DEBUG_1, "pam_smtpauth(smtpauth): connection error = %s",strerror(errno));
+        log_debug(DEBUG_1, "smtp_auth: connection error = %s",strerror(errno));
 #endif
         smtp->error = 1;
         strcpy(msgbuf, "Error: connecting to ");
@@ -501,7 +500,7 @@ smtp_auth(config_t *cfg) {
     }
 #endif
 
-    /* CLAIM: we now have a TCP connection to the remote SMTP server */
+    /* TCP connection to the remote SMTP server */
     if(cfg->timeout > 0) {
         set_timeout(cfg->timeout);
     }
@@ -511,7 +510,7 @@ smtp_auth(config_t *cfg) {
     }
     if(rc == -1) {
 #ifdef DEBUG
-        log_debug(DEBUG_1, "pam_smtpauth(smtpauth): read (banner): %m");
+        log_debug(DEBUG_1, "smtp_auth: read (banner): %m");
 #endif
         smtp->error = 1;
         strcpy(msgbuf, RESP_SYNCERROR);
@@ -527,7 +526,7 @@ smtp_auth(config_t *cfg) {
 
     if(strncmp(rbuf, "220 ", sizeof("220 ")-1)) {
 #ifdef DEBUG
-        log_debug(DEBUG_1, "pam_smtpauth(smtpauth): unexpected response during initial handshake: %s", rbuf);
+        log_debug(DEBUG_1, "smtp_auth: unexpected response during initial handshake: %s", rbuf);
 #endif
         smtp->error = 1;
         strcpy(msgbuf, RESP_UNEXPECTED);
@@ -550,7 +549,7 @@ smtp_auth(config_t *cfg) {
     iov[2].iov_len  = sizeof("\r\n") - 1;
 
 #ifdef DEBUG
-    log_debug(DEBUG_9, "pam_smtpauth(smtpauth): sending %s%s", EHLO_CMD, myhostname);
+    log_debug(DEBUG_9, "smtp_auth: sending %s%s", EHLO_CMD, myhostname);
 #endif
     if(cfg->timeout > 0) {
         set_timeout(cfg->timeout);
@@ -562,7 +561,7 @@ smtp_auth(config_t *cfg) {
     }
     if(rc == -1) {
 #ifdef DEBUG
-        log_debug(DEBUG_1, "pam_smtpauth(smtpauth): writev: %m");
+        log_debug(DEBUG_1, "smtp_auth: writev: %m");
 #endif
         smtp->error = 1;
         strcpy(msgbuf, RESP_IERROR);
@@ -581,7 +580,7 @@ smtp_auth(config_t *cfg) {
     }
     if(rc == -1) {
 #ifdef DEBUG
-        log_debug(DEBUG_1, "pam_smtpauth(smtpauth): read (response): %m");
+        log_debug(DEBUG_1, "smtp_auth: read (response): %m");
 #endif
         smtp->error = 1;
         strcpy(msgbuf, RESP_IERROR);
@@ -592,7 +591,7 @@ smtp_auth(config_t *cfg) {
 
     if((tbuf = strstr(rbuf, "250-STARTTLS"))) {
 #ifdef DEBUG
-        log_debug(DEBUG_1, "pam_smtpauth(smtpauth): STARTTLS not supported.");
+        log_debug(DEBUG_1, "smtp_auth: STARTTLS not supported.");
 #endif
     }
 
@@ -617,7 +616,7 @@ smtp_auth(config_t *cfg) {
 
     if(avail_auth_type == 0) {
 #ifdef DEBUG
-        log_debug(DEBUG_1, "pam_smtpauth(smtpauth): smtp authentication is not implemented: %s", rbuf);
+        log_debug(DEBUG_1, "smtp_auth: smtp authentication is not implemented: %s", rbuf);
 #endif
         smtp->error = 1;
         strcpy(msgbuf, RESP_UNEXPECTED);
@@ -626,7 +625,7 @@ smtp_auth(config_t *cfg) {
         goto bail;
     }
 #ifdef DEBUG
-    log_debug(DEBUG_1, "pam_smtpauth(smtpauth): auth_type: %d", avail_auth_type);
+    log_debug(DEBUG_1, "smtp_auth: auth_type=%d", avail_auth_type);
 #endif
 
     /* build the AUTH command */
@@ -644,7 +643,7 @@ smtp_auth(config_t *cfg) {
     }
     else {
 #ifdef DEBUG
-        log_debug(DEBUG_1, "pam_smtpauth(smtpauth): smtp authentication is not implemented: %s", rbuf);
+        log_debug(DEBUG_1, "smtp_auth: smtp authentication is not implemented: %s", rbuf);
 #endif
         smtp->error = 1;
         strcpy(msgbuf, RESP_UNEXPECTED);
@@ -654,11 +653,11 @@ smtp_auth(config_t *cfg) {
     }
 
 #ifdef DEBUG
-    log_debug(DEBUG_5, "pam_smtpauth(smtpauth) auth: [%d]", auth);
+    log_debug(DEBUG_5, "smtp_auth: auth=%d", auth);
 #endif
     if(auth == 0) {
 #ifdef DEBUG
-        log_debug(DEBUG_1, "pam_smtpauth(smtpauth) rejected: [%s]", global.username);
+        log_debug(DEBUG_1, "smtp_auth: rejected=%s", global.username);
 #endif
         smtp->error = 2;
         strcpy(msgbuf, RESP_CREDERROR);
@@ -692,7 +691,7 @@ smtp_quit(socket_t *sock, config_t *cfg) {
     iov[1].iov_len  = sizeof("\r\n") - 1;
 
 #ifdef DEBUG
-    log_debug(DEBUG_9, "pam_smtpauth(smtpauth): sending %s", QUIT_CMD);
+    log_debug(DEBUG_9, "smtp_quit: sending %s", QUIT_CMD);
 #endif
     if(cfg->timeout > 0) {
         set_timeout(cfg->timeout);
@@ -704,7 +703,7 @@ smtp_quit(socket_t *sock, config_t *cfg) {
     }
     if(rc == -1) {
 #ifdef DEBUG
-        log_debug(DEBUG_1, "pam_smtpauth(smtpauth): quit writev: %m");
+        log_debug(DEBUG_1, "smtp_quit: quit writev: %m");
 #endif
     }
     (void)socket_close(sock);
@@ -721,7 +720,7 @@ auth_cram_md5(socket_t *sock, config_t *cfg) {
     char buf[RESP_LEN];
 
 #ifdef DEBUG
-    log_debug(DEBUG_1, "pam_smtpauth(smtpauth): AUTH CRAM-MD5");
+    log_debug(DEBUG_1, "auth_cram_md5: AUTH CRAM-MD5");
 #endif
     iov[0].iov_base = AUTH_CMD;
     iov[0].iov_len  = sizeof(AUTH_CMD) - 1;
@@ -731,7 +730,7 @@ auth_cram_md5(socket_t *sock, config_t *cfg) {
     iov[2].iov_len  = sizeof("\r\n") - 1;
 
 #ifdef DEBUG
-    log_debug(DEBUG_9, "pam_smtpauth(smtpauth): sending %s%s", AUTH_CMD, "CRAM-MD5");
+    log_debug(DEBUG_9, "auth_cram_md5: sending %s%s", AUTH_CMD, "CRAM-MD5");
 #endif
     if(cfg->timeout > 0) {
         set_timeout(cfg->timeout);
@@ -743,7 +742,7 @@ auth_cram_md5(socket_t *sock, config_t *cfg) {
     }
     if(rc == -1) {
 #ifdef DEBUG
-        log_debug(DEBUG_1, "pam_smtpauth(smtpauth): cram-md5 writev: %m");
+        log_debug(DEBUG_1, "auth_cram_md5: cram-md5 writev: %m");
 #endif
         return AUTH_NG;
     }
@@ -757,13 +756,13 @@ auth_cram_md5(socket_t *sock, config_t *cfg) {
     }
     if(rc == -1) {
 #ifdef DEBUG
-        log_debug(DEBUG_1, "pam_smtpauth(smtpauth): read (response): %m");
+        log_debug(DEBUG_1, "auth_cram_md5: read (response): %m");
 #endif
         return AUTH_NG;
     }
 
 #ifdef DEBUG
-    log_debug(DEBUG_5, "pam_smtpauth(smtpauth): read (response): %s",rbuf);
+    log_debug(DEBUG_5, "auth_cram_md5: read (response): %s",rbuf);
 #endif
     if(strncmp(rbuf, "334 ", sizeof("334 ")-1) == 0) {
         char *response;
@@ -776,7 +775,7 @@ auth_cram_md5(socket_t *sock, config_t *cfg) {
         challengelen = base64_decode((char *)challenge, rbuf + 4, -1);
         challenge[challengelen] = '\0';
 #ifdef DEBUG
-        log_debug(DEBUG_9, "pam_smtpauth(smtpauth): challenge=%s", challenge);
+        log_debug(DEBUG_9, "auth_cram_md5: challenge=%s", challenge);
 #endif
 
         snprintf(buf, sizeof(buf), "%s", cfg->password);
@@ -795,7 +794,7 @@ auth_cram_md5(socket_t *sock, config_t *cfg) {
         iov[1].iov_len  = sizeof("\r\n") - 1;
 
 #ifdef DEBUG
-        log_debug(DEBUG_9, "pam_smtpauth(smtpauth): sending %s", response64);
+        log_debug(DEBUG_9, "auth_cram_md5: sending %s", response64);
 #endif
         if(cfg->timeout > 0) {
             set_timeout(cfg->timeout);
@@ -807,7 +806,7 @@ auth_cram_md5(socket_t *sock, config_t *cfg) {
         }
         if(rc == -1) {
 #ifdef DEBUG
-            log_debug(DEBUG_1, "pam_smtpauth(smtpauth): cram-md5 writev: %m");
+            log_debug(DEBUG_1, "auth_cram_md5: cram-md5 writev: %m");
 #endif
             return AUTH_NG;
         }
@@ -821,24 +820,24 @@ auth_cram_md5(socket_t *sock, config_t *cfg) {
         }
         if(rc == -1) {
 #ifdef DEBUG
-            log_debug(DEBUG_1, "pam_smtpauth(smtpauth): read (response): %m");
+            log_debug(DEBUG_1, "auth_cram_md5: read (response): %m");
 #endif
             return AUTH_NG;
         }
 
 #ifdef DEBUG
-        log_debug(DEBUG_5, "pam_smtpauth(smtpauth): read (response): %s",rbuf);
+        log_debug(DEBUG_5, "auth_cram_md5: read (response): %s",rbuf);
 #endif
         if(strncmp(rbuf, "235 ", sizeof("235 ")-1) != 0) {
 #ifdef DEBUG
-            log_debug(DEBUG_1, "pam_smtpauth(smtpauth): auth failure.");
+            log_debug(DEBUG_1, "auth_cram_md5: auth failure.");
 #endif
             return AUTH_NG;
         }
         free(response64);
     } else {
 #ifdef DEBUG
-        log_debug(DEBUG_1, "pam_smtpauth(smtpauth): it seems cram-md5 mech is not implemented.");
+        log_debug(DEBUG_1, "auth_cram_md5: it seems cram-md5 mech is not implemented.");
 #endif
         return AUTH_NG;
     }
@@ -856,7 +855,7 @@ auth_login(socket_t *sock, config_t *cfg) {
     char *buf;
 
 #ifdef DEBUG
-    log_debug(DEBUG_1, "pam_smtpauth(smtpauth): AUTH LOGIN");
+    log_debug(DEBUG_1, "auth_login: AUTH LOGIN");
 #endif
     iov[0].iov_base = AUTH_CMD;
     iov[0].iov_len  = sizeof(AUTH_CMD) - 1;
@@ -866,7 +865,7 @@ auth_login(socket_t *sock, config_t *cfg) {
     iov[2].iov_len  = sizeof("\r\n") - 1;
 
 #ifdef DEBUG
-    log_debug(DEBUG_9, "pam_smtpauth(smtpauth): sending %s%s", AUTH_CMD, "LOGIN");
+    log_debug(DEBUG_9, "auth_login: sending %s%s", AUTH_CMD, "LOGIN");
 #endif
     if(cfg->timeout > 0) {
         set_timeout(cfg->timeout);
@@ -878,7 +877,7 @@ auth_login(socket_t *sock, config_t *cfg) {
     }
     if(rc == -1) {
 #ifdef DEBUG
-        log_debug(DEBUG_1, "pam_smtpauth(smtpauth): login writev: %m");
+        log_debug(DEBUG_1, "auth_login: login writev: %m");
 #endif
         return AUTH_NG;
     }
@@ -892,13 +891,13 @@ auth_login(socket_t *sock, config_t *cfg) {
     }
     if(rc == -1) {
 #ifdef DEBUG
-        log_debug(DEBUG_1, "pam_smtpauth(smtpauth): read (response): %m");
+        log_debug(DEBUG_1, "auth_login: read (response): %m");
 #endif
         return AUTH_NG;
     }
 
 #ifdef DEBUG
-    log_debug(DEBUG_5, "pam_smtpauth(smtpauth): read (response): %s",rbuf);
+    log_debug(DEBUG_5, "auth_login: read (response): %s",rbuf);
 #endif
     if(strncmp(rbuf, "334 ", sizeof("334 ")-1) == 0) {
         buf = malloc(sizeof(char)*128);
@@ -910,7 +909,7 @@ auth_login(socket_t *sock, config_t *cfg) {
         iov[1].iov_len  = sizeof("\r\n") - 1;
 
 #ifdef DEBUG
-        log_debug(DEBUG_9, "pam_smtpauth(smtpauth): sending %s", buf);
+        log_debug(DEBUG_9, "auth_login: sending %s", buf);
 #endif
         if(cfg->timeout > 0) {
             set_timeout(cfg->timeout);
@@ -922,7 +921,7 @@ auth_login(socket_t *sock, config_t *cfg) {
         }
         if(rc == -1) {
 #ifdef DEBUG
-            log_debug(DEBUG_1, "pam_smtpauth(smtpauth): login writev: %m");
+            log_debug(DEBUG_1, "auth_login: login writev: %m");
 #endif
             return AUTH_NG;
         }
@@ -936,13 +935,13 @@ auth_login(socket_t *sock, config_t *cfg) {
         }
         if(rc == -1) {
 #ifdef DEBUG
-            log_debug(DEBUG_1, "pam_smtpauth(smtpauth): read (response): %m");
+            log_debug(DEBUG_1, "auth_login: read (response): %m");
 #endif
             return AUTH_NG;
         }
 
 #ifdef DEBUG
-        log_debug(DEBUG_5, "pam_smtpauth(smtpauth): read (response): %s",rbuf);
+        log_debug(DEBUG_5, "auth_login: read (response): %s",rbuf);
 #endif
         if(strncmp(rbuf, "334 ", sizeof("334 ")-1) == 0) {
             buf = malloc(sizeof(char)*128);
@@ -954,7 +953,7 @@ auth_login(socket_t *sock, config_t *cfg) {
             iov[1].iov_len  = sizeof("\r\n") - 1;
 
 #ifdef DEBUG
-            log_debug(DEBUG_9, "pam_smtpauth(smtpauth): sending %s", buf);
+            log_debug(DEBUG_9, "auth_login: sending %s", buf);
 #endif
             if(cfg->timeout > 0) {
                 set_timeout(cfg->timeout);
@@ -966,7 +965,7 @@ auth_login(socket_t *sock, config_t *cfg) {
             }
             if(rc == -1) {
 #ifdef DEBUG
-                log_debug(DEBUG_1, "pam_smtpauth(smtpauth): login writev: %m");
+                log_debug(DEBUG_1, "auth_login: login writev: %m");
 #endif
                 return AUTH_NG;
             }
@@ -980,29 +979,29 @@ auth_login(socket_t *sock, config_t *cfg) {
             }
             if(rc == -1) {
 #ifdef DEBUG
-                log_debug(DEBUG_1, "pam_smtpauth(smtpauth): read (response): %m");
+                log_debug(DEBUG_1, "auth_login: read (response): %m");
 #endif
                 return AUTH_NG;
             }
 
 #ifdef DEBUG
-            log_debug(DEBUG_5, "pam_smtpauth(smtpauth): read (response): %s",rbuf);
+            log_debug(DEBUG_5, "auth_login: read (response): %s",rbuf);
 #endif
             if(strncmp(rbuf, "235 ", sizeof("235 ")-1) != 0) {
 #ifdef DEBUG
-                log_debug(DEBUG_1, "pam_smtpauth(smtpauth): auth failure.");
+                log_debug(DEBUG_1, "auth_login: auth failure.");
 #endif
                 return AUTH_NG;
             }
         } else {
 #ifdef DEBUG
-            log_debug(DEBUG_1, "pam_smtpauth(smtpauth): it seems login mech is not implemented.");
+            log_debug(DEBUG_1, "auth_login: it seems login mech is not implemented.");
 #endif
             return AUTH_NG;
         }
     } else {
 #ifdef DEBUG
-        log_debug(DEBUG_1, "pam_smtpauth(smtpauth): it seems login mech is not implemented.");
+        log_debug(DEBUG_1, "auth_login: it seems login mech is not implemented.");
 #endif
         return AUTH_NG;
     }
@@ -1022,7 +1021,7 @@ auth_plain(socket_t *sock, config_t *cfg) {
     char phrase[512];
 
 #ifdef DEBUG
-    log_debug(DEBUG_1, "pam_smtpauth(smtpauth): AUTH PLAIN");
+    log_debug(DEBUG_1, "auth_plain: AUTH PLAIN");
 #endif
     sprintf(phrase,"%s^%s^%s", cfg->username, cfg->username, cfg->password);
     len = strlen(phrase);
@@ -1044,7 +1043,7 @@ auth_plain(socket_t *sock, config_t *cfg) {
     iov[3].iov_len  = sizeof("\r\n") - 1;
 
 #ifdef DEBUG
-    log_debug(DEBUG_9, "pam_smtpauth(smtpauth): sending %s%s %s", AUTH_CMD, "PLAIN", buf);
+    log_debug(DEBUG_9, "auth_plain: sending %s%s %s", AUTH_CMD, "PLAIN", buf);
 #endif
     if(cfg->timeout > 0) {
         set_timeout(cfg->timeout);
@@ -1057,7 +1056,7 @@ auth_plain(socket_t *sock, config_t *cfg) {
     }
     if(rc == -1) {
 #ifdef DEBUG
-        log_debug(DEBUG_1, "pam_smtpauth(smtpauth): plain writev: %m");
+        log_debug(DEBUG_1, "auth_plain: plain writev: %m");
 #endif
         return AUTH_NG;
     }
@@ -1071,18 +1070,18 @@ auth_plain(socket_t *sock, config_t *cfg) {
     }
     if(rc == -1) {
 #ifdef DEBUG
-        log_debug(DEBUG_1, "pam_smtpauth(smtpauth): read (response): %m");
+        log_debug(DEBUG_1, "auth_plain: read (response): %m");
 #endif
         return AUTH_NG;
     }
 
 #ifdef DEBUG
-    log_debug(DEBUG_5, "pam_smtpauth(smtpauth): read (response): %s",rbuf);
+    log_debug(DEBUG_5, "auth_plain: read (response): %s",rbuf);
 #endif
 
     if(strncmp(rbuf, "235 ", sizeof("235 ")-1) != 0) {
 #ifdef DEBUG
-        log_debug(DEBUG_1, "pam_smtpauth(smtpauth): auth failure.");
+        log_debug(DEBUG_1, "auth_plain: auth failure.");
 #endif
         return AUTH_NG;
     }
@@ -1099,7 +1098,7 @@ auth_digest_md5(socket_t *sock, config_t *cfg) {
     char *buf;
 
 #ifdef DEBUG
-    log_debug(DEBUG_1, "pam_smtpauth(smtpauth): AUTH DIGEST-MD5");
+    log_debug(DEBUG_1, "auth_digest_md5: AUTH DIGEST-MD5");
 #endif
 
     iov[0].iov_base = AUTH_CMD;
@@ -1110,7 +1109,7 @@ auth_digest_md5(socket_t *sock, config_t *cfg) {
     iov[2].iov_len  = sizeof("\r\n") - 1;
 
 #ifdef DEBUG
-    log_debug(DEBUG_9, "pam_smtpauth(smtpauth): sending %s%s", AUTH_CMD, "DIGEST-MD5");
+    log_debug(DEBUG_9, "auth_digest_md5: sending %s%s", AUTH_CMD, "DIGEST-MD5");
 #endif
     if(cfg->timeout > 0) {
         set_timeout(cfg->timeout);
@@ -1122,7 +1121,7 @@ auth_digest_md5(socket_t *sock, config_t *cfg) {
     }
     if(rc == -1) {
 #ifdef DEBUG
-        log_debug(DEBUG_1, "pam_smtpauth(smtpauth): digest-md5 writev: %m");
+        log_debug(DEBUG_1, "auth_digest_md5: digest-md5 writev: %m");
 #endif
         return AUTH_NG;
     }
@@ -1136,13 +1135,13 @@ auth_digest_md5(socket_t *sock, config_t *cfg) {
     }
     if(rc == -1) {
 #ifdef DEBUG
-        log_debug(DEBUG_1, "pam_smtpauth(smtpauth): read (response): %m");
+        log_debug(DEBUG_1, "auth_digest_md5: read (response): %m");
 #endif
         return AUTH_NG;
     }
 
 #ifdef DEBUG
-    log_debug(DEBUG_5, "pam_smtpauth(smtpauth): read (response): %s",rbuf);
+    log_debug(DEBUG_5, "auth_digest_md5: read (response): %s",rbuf);
 #endif
     if(strncmp(rbuf, "334 ", sizeof("334 ")-1) == 0) {
         char *response;
@@ -1155,24 +1154,24 @@ auth_digest_md5(socket_t *sock, config_t *cfg) {
         challengelen = base64_decode(challenge, rbuf + 4, -1);
         challenge[challengelen] = '\0';
 #ifdef DEBUG
-        log_debug(DEBUG_9, "pam_smtpauth(smtpauth): challenge=%s", challenge);
+        log_debug(DEBUG_9, "auth_digest_md5: challenge=%s", challenge);
 #endif
 
         digest_md5((char *)hexdigest, (unsigned char*)challenge, challengelen, cfg->username, cfg->password);
 #ifdef DEBUG
-        log_debug(DEBUG_9, "pam_smtpauth(smtpauth): hexdigest=%s", hexdigest);
+        log_debug(DEBUG_9, "auth_digest_md5: hexdigest=%s", hexdigest);
 #endif
 
         response = malloc(sizeof(char)*256);
         snprintf(response, 256, "%s", hexdigest);
 #ifdef DEBUG
-        log_debug(DEBUG_9, "pam_smtpauth(smtpauth): response=%s", response);
+        log_debug(DEBUG_9, "auth_digest_md5: response=%s", response);
 #endif
         response64 = malloc((strlen(response) + 3) * 2 + 1);
         base64_encode(response64, response, strlen(response));
         free(response);
 #ifdef DEBUG
-        log_debug(DEBUG_9, "pam_smtpauth(smtpauth): response64=%s", response64);
+        log_debug(DEBUG_9, "auth_digest_md5: response64=%s", response64);
 #endif
 
         iov[0].iov_base = response64;
@@ -1181,7 +1180,7 @@ auth_digest_md5(socket_t *sock, config_t *cfg) {
         iov[1].iov_len  = sizeof("\r\n") - 1;
 
 #ifdef DEBUG
-        log_debug(DEBUG_9, "pam_smtpauth(smtpauth): sending %s", response64);
+        log_debug(DEBUG_9, "auth_digest_md5: sending %s", response64);
 #endif
         if(cfg->timeout > 0) {
             set_timeout(cfg->timeout);
@@ -1193,7 +1192,7 @@ auth_digest_md5(socket_t *sock, config_t *cfg) {
         }
         if(rc == -1) {
 #ifdef DEBUG
-            log_debug(DEBUG_1, "pam_smtpauth(smtpauth): digest-md5 writev: %m");
+            log_debug(DEBUG_1, "auth_digest_md5: digest-md5 writev: %m");
 #endif
             return AUTH_NG;
         }
@@ -1207,13 +1206,13 @@ auth_digest_md5(socket_t *sock, config_t *cfg) {
         }
         if(rc == -1) {
 #ifdef DEBUG
-            log_debug(DEBUG_1, "pam_smtpauth(smtpauth): read (response): %m");
+            log_debug(DEBUG_1, "auth_digest_md5: read (response): %m");
 #endif
             return AUTH_NG;
         }
 
 #ifdef DEBUG
-        log_debug(DEBUG_5, "pam_smtpauth(smtpauth): read (response): %s",rbuf);
+        log_debug(DEBUG_5, "auth_digest_md5: read (response): %s",rbuf);
 #endif
         if(strncmp(rbuf, "334 ", sizeof("334 ")-1) == 0) {
             int buflen;
@@ -1228,7 +1227,7 @@ auth_digest_md5(socket_t *sock, config_t *cfg) {
             iov[1].iov_len  = sizeof("\r\n") - 1;
 
 #ifdef DEBUG
-            log_debug(DEBUG_9, "pam_smtpauth(smtpauth): sending %s", buf);
+            log_debug(DEBUG_9, "auth_digest_md5: sending %s", buf);
 #endif
             if(cfg->timeout > 0) {
                 set_timeout(cfg->timeout);
@@ -1240,7 +1239,7 @@ auth_digest_md5(socket_t *sock, config_t *cfg) {
             }
             if(rc == -1) {
 #ifdef DEBUG
-                log_debug(DEBUG_1, "pam_smtpauth(smtpauth): digest-md5 writev: %m");
+                log_debug(DEBUG_1, "auth_digest_md5: digest-md5 writev: %m");
 #endif
                 return AUTH_NG;
             }
@@ -1254,30 +1253,30 @@ auth_digest_md5(socket_t *sock, config_t *cfg) {
             }
             if(rc == -1) {
 #ifdef DEBUG
-                log_debug(DEBUG_1, "pam_smtpauth(smtpauth): read (response): %m");
+                log_debug(DEBUG_1, "auth_digest_md5: read (response): %m");
 #endif
                 return AUTH_NG;
             }
 
 #ifdef DEBUG
-            log_debug(DEBUG_5, "pam_smtpauth(smtpauth): read (response): %s",rbuf);
+            log_debug(DEBUG_5, "auth_digest_md5: read (response): %s",rbuf);
 #endif
             if(strncmp(rbuf, "235 ", sizeof("235 ")-1) != 0) {
 #ifdef DEBUG
-                log_debug(DEBUG_1, "pam_smtpauth(smtpauth): auth failure.");
+                log_debug(DEBUG_1, "auth_digest_md5: auth failure.");
 #endif
                 return AUTH_NG;
             }
         } else {
 #ifdef DEBUG
-            log_debug(DEBUG_1, "pam_smtpauth(smtpauth): it seems digest-md5 mech is not implemented.");
+            log_debug(DEBUG_1, "auth_digest_md5: it seems digest-md5 mech is not implemented.");
 #endif
             return AUTH_NG;
         }
         free(response64);
     } else {
 #ifdef DEBUG
-        log_debug(DEBUG_1, "pam_smtpauth(smtpauth): it seems digest-md5 mech is not implemented.");
+        log_debug(DEBUG_1, "auth_digest_md5: it seems digest-md5 mech is not implemented.");
 #endif
         return AUTH_NG;
     }
@@ -1300,7 +1299,7 @@ verify_cert(SSL *ssl) {
     cert = SSL_get_peer_certificate(ssl);
     if(!cert) {
 #ifdef DEBUG
-        log_debug(DEBUG_1, "pam_smtpauth(smtpauth): Error: no server certificate.");
+        log_debug(DEBUG_1, "verify_cert: Error: no server certificate.");
 #endif
         return -1;
     }
@@ -1311,7 +1310,7 @@ verify_cert(SSL *ssl) {
     }
 
 #ifdef DEBUG
-    log_debug(DEBUG_1, "pam_smtpauth(smtpauth): Error: can't verify certificate: %s (%d).", X509_verify_cert_error_string(err), err);
+    log_debug(DEBUG_1, "verify_cert: Error: can't verify certificate: %s (%d).", X509_verify_cert_error_string(err), err);
 #endif
     X509_NAME_oneline(X509_get_subject_name(cert), buf, sizeof(buf));
     fprintf(stderr,"\nSubject: %s\n", buf);
@@ -1349,7 +1348,7 @@ init_ssl(config_t *conf) {
 
     if(!conf->certfile) {
 #ifdef DEBUG
-        log_debug(DEBUG_1, "pam_smtpauth(smtpauth): Error: SSLCertificateFile not defined.");
+        log_debug(DEBUG_1, "init_ssl: Error: SSLCertificateFile not defined.");
 #endif
         return -1;
     }
@@ -1365,16 +1364,16 @@ init_ssl(config_t *conf) {
     if(access(conf->certfile, F_OK)) {
         if(errno != ENOENT) {
 #ifdef DEBUG
-            log_debug(DEBUG_1, "pam_smtpauth(smtpauth): Error: SSLCertificateFile is not accessible.");
+            log_debug(DEBUG_1, "init_ssl: Error: SSLCertificateFile is not accessible.");
 #endif
             return -1;
         }
 #ifdef DEBUG
-        log_debug(DEBUG_1, "pam_smtpauth(smtpauth): Warning: SSLCertificateFile doesn't exist, can't verify server certificates.");
+        log_debug(DEBUG_1, "init_ssl: Warning: SSLCertificateFile doesn't exist, can't verify server certificates.");
 #endif
     } else if(!SSL_CTX_load_verify_locations(SSLContext, conf->certfile, NULL)) {
 #ifdef DEBUG
-        log_debug(DEBUG_1, "pam_smtpauth(smtpauth): Error: SSL_CTX_load_verify_locations: %s.",ERR_error_string(ERR_get_error(), 0));
+        log_debug(DEBUG_1, "init_ssl: Error: SSL_CTX_load_verify_locations: %s.",ERR_error_string(ERR_get_error(), 0));
 #endif
         SSL_CTX_free(SSLContext);
         return -1;
@@ -1404,7 +1403,7 @@ start_tls(smtp_t *smtp, config_t *cfg) {
     /* initialize SSL */
     if(init_ssl(cfg)) {
 #ifdef DEBUG
-        log_debug(DEBUG_1, "pam_smtpauth(smtpauth): failed to initialize ssl session.");
+        log_debug(DEBUG_1, "start_tls: failed to initialize ssl session.");
 #endif
         return 1;
     }
@@ -1414,7 +1413,7 @@ start_tls(smtp_t *smtp, config_t *cfg) {
     if((ret = SSL_connect(smtp->sock->ssl)) <= 0) {
         socket_perror("connect", smtp->sock, ret);
 #ifdef DEBUG
-        log_debug(DEBUG_1, "pam_smtpauth(smtpauth): failed to connect ssl session.");
+        log_debug(DEBUG_1, "start_tls: failed to connect ssl session.");
 #endif
         return 1;
     }
@@ -1426,7 +1425,7 @@ start_tls(smtp_t *smtp, config_t *cfg) {
 #endif
     smtp->sock->use_ssl = 1;
 #ifdef DEBUG
-    log_debug(DEBUG_1, "pam_smtpauth(smtpauth): SSL support enabled.");
+    log_debug(DEBUG_1, "start_tls: SSL support enabled.");
 #endif
     return 0;
 }
index e85e946..d5efb05 100644 (file)
@@ -53,7 +53,7 @@ void
 sig_timeout(void) {
     signal(SIGALRM, SIG_IGN);
     alarm(0);
-    syslog(LOG_ERR, "connection is timed out");
+    syslog(LOG_ERR, "[pam_smtpauth] connection is timed out");
     exit(1);
 }