[dovecot-cvs] dovecot/src/imap main.c,1.27,1.28
cras at procontrol.fi
cras at procontrol.fi
Tue Feb 18 22:50:11 EET 2003
- Previous message: [dovecot-cvs] dovecot/src/auth password-scheme.c,NONE,1.1 password-scheme.h,NONE,1.1 Makefile.am,1.13,1.14 mech-digest-md5.c,1.9,1.10 passdb-ldap.c,1.5,1.6 passdb-passwd-file.c,1.5,1.6 passdb.c,1.6,1.7 password-verify.c,1.1,NONE password-verify.h,1.1,NONE
- Next message: [dovecot-cvs] dovecot/src/imap main.c,1.28,1.29
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/dovecot/src/imap
In directory danu:/tmp/cvs-serv11961
Modified Files:
main.c
Log Message:
Use getlogin() alternatively if USER environment isn't found.
Index: main.c
===================================================================
RCS file: /home/cvs/dovecot/src/imap/main.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- main.c 14 Feb 2003 10:46:44 -0000 1.27
+++ main.c 18 Feb 2003 20:50:09 -0000 1.28
@@ -10,6 +10,7 @@
#include "mail-storage.h"
#include <stdlib.h>
+#include <unistd.h>
#include <syslog.h>
#define IS_STANDALONE() \
@@ -30,7 +31,12 @@
const char *user;
user = getenv("USER");
- if (user == NULL) user = "??";
+ if (user == NULL) {
+ if (!IS_STANDALONE())
+ user = getlogin();
+ if (user == NULL)
+ user = "??";
+ }
if (strlen(user) >= sizeof(log_prefix)-6) {
/* quite a long user name, cut it */
user = t_strndup(user, sizeof(log_prefix)-6-2);
@@ -63,13 +69,18 @@
{
struct client *client;
struct mail_storage *storage;
- const char *mail, *str;
+ const char *user, *mail, *str;
int hin, hout;
lib_init_signals(sig_quit);
- if (getenv("USER") == NULL)
- i_fatal("USER environment missing");
+ user = getenv("USER");
+ if (user == NULL) {
+ if (!IS_STANDALONE())
+ user = getlogin();
+ if (user == NULL)
+ i_fatal("USER environment missing");
+ }
hin = 0; hout = 1;
rawlog_open(&hin, &hout);
@@ -86,7 +97,7 @@
mail = t_strconcat("maildir:", mail, NULL);
}
- storage = mail_storage_create_with_data(mail, getenv("USER"));
+ storage = mail_storage_create_with_data(mail, user);
if (storage == NULL) {
/* failed */
if (mail != NULL && *mail != '\0')
@@ -116,7 +127,7 @@
if (IS_STANDALONE()) {
client_send_line(client, t_strconcat(
"* PREAUTH [CAPABILITY "CAPABILITY_STRING"] "
- "Logged in as ", getenv("USER"), NULL));
+ "Logged in as ", user, NULL));
}
}
- Previous message: [dovecot-cvs] dovecot/src/auth password-scheme.c,NONE,1.1 password-scheme.h,NONE,1.1 Makefile.am,1.13,1.14 mech-digest-md5.c,1.9,1.10 passdb-ldap.c,1.5,1.6 passdb-passwd-file.c,1.5,1.6 passdb.c,1.6,1.7 password-verify.c,1.1,NONE password-verify.h,1.1,NONE
- Next message: [dovecot-cvs] dovecot/src/imap main.c,1.28,1.29
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the dovecot-cvs
mailing list