return;
}
- if (CtdlLoginExistingUser(parms[2]) == login_ok) {
+ if (CtdlLoginExistingUser(NULL, parms[2]) == login_ok) {
if (CtdlTryPassword(parms[3]) == pass_ok) {
cprintf("%s OK [", parms[0]);
imap_output_capability_string();
}
if (!strcasecmp(parms[2], "PLAIN")) {
- CtdlEncodeBase64(buf, "Username:", 9);
- cprintf("+ %s\r\n", buf);
+ // CtdlEncodeBase64(buf, "Username:", 9);
+ // cprintf("+ %s\r\n", buf);
+ cprintf("+ \r\n");
IMAP->authstate = imap_as_expecting_plainauth;
strcpy(IMAP->authseq, parms[0]);
return;
char ident[256];
char user[256];
char pass[256];
+ int result;
CtdlDecodeBase64(decoded_authstring, cmd, strlen(cmd));
safestrncpy(ident, decoded_authstring, sizeof ident);
safestrncpy(pass, &decoded_authstring[strlen(ident) + strlen(user) + 2], sizeof pass);
IMAP->authstate = imap_as_normal;
- if (CtdlLoginExistingUser(user) == login_ok) {
+
+ if (strlen(ident) > 0) {
+ result = CtdlLoginExistingUser(user, ident);
+ }
+ else {
+ result = CtdlLoginExistingUser(NULL, user);
+ }
+
+ if (result == login_ok) {
if (CtdlTryPassword(pass) == pass_ok) {
cprintf("%s OK authentication succeeded\r\n", IMAP->authseq);
return;
char buf[SIZ];
CtdlDecodeBase64(buf, cmd, SIZ);
- CtdlLoginExistingUser(buf);
+ CtdlLoginExistingUser(NULL, buf);
CtdlEncodeBase64(buf, "Password:", 9);
cprintf("+ %s\r\n", buf);
IMAP->authstate = imap_as_expecting_password;
/**
- * $Id: $
+ * $Id$
*
* This module is an managesieve implementation for the Citadel system.
* It is compliant with all of the following:
else
retval = CtdlDecodeBase64(auth, parms[2], SIZ);
- if (login_ok == CtdlLoginExistingUser(auth))
+ if (login_ok == CtdlLoginExistingUser(NULL, auth))
{
char *pass;
pass = &(auth[strlen(auth)+1]);
managesieve_command_loop,
NULL);
- return "$Id: serv_managesieve.c 4570 2006-08-27 02:07:18Z dothebart $";
+ return "$Id$";
}
#else /* HAVE_LIBSIEVE */
char *serv_managesieve_init(void)
{
lprintf(CTDL_INFO, "This server is missing libsieve. Managesieve protocol is disabled..\n");
- return "$Id: $";
+ return "$Id$";
}
#endif /* HAVE_LIBSIEVE */
striplt(username);
/* lprintf(CTDL_DEBUG, "Trying <%s>\n", username); */
- if (CtdlLoginExistingUser(username) == login_ok) {
+ if (CtdlLoginExistingUser(NULL, username) == login_ok) {
cprintf("+OK Password required for %s\r\n", username);
}
else {
memset(userdigest, MD5_HEXSTRING_SIZE, 0);
strncpy(userdigest, sptr, MD5_HEXSTRING_SIZE-1);
- if (CtdlLoginExistingUser(username) != login_ok)
+ if (CtdlLoginExistingUser(NULL, username) != login_ok)
{
cprintf("-ERR No such user.\r\n");
return;
CtdlDecodeBase64(username, argbuf, SIZ);
/* lprintf(CTDL_DEBUG, "Trying <%s>\n", username); */
- if (CtdlLoginExistingUser(username) == login_ok) {
+ if (CtdlLoginExistingUser(NULL, username) == login_ok) {
CtdlEncodeBase64(buf, "Password:", 9);
cprintf("334 %s\r\n", buf);
SMTP->command_state = smtp_password;
char ident[256];
char user[256];
char pass[256];
+ int result;
- CtdlDecodeBase64(decoded_authstring,
- encoded_authstring,
- strlen(encoded_authstring) );
+ CtdlDecodeBase64(decoded_authstring, encoded_authstring, strlen(encoded_authstring) );
safestrncpy(ident, decoded_authstring, sizeof ident);
safestrncpy(user, &decoded_authstring[strlen(ident) + 1], sizeof user);
safestrncpy(pass, &decoded_authstring[strlen(ident) + strlen(user) + 2], sizeof pass);
SMTP->command_state = smtp_command;
- if (CtdlLoginExistingUser(user) == login_ok) {
+
+ if (strlen(ident) > 0) {
+ result = CtdlLoginExistingUser(user, ident);
+ }
+ else {
+ result = CtdlLoginExistingUser(NULL, user);
+ }
+
+ if (result == login_ok) {
if (CtdlTryPassword(pass) == pass_ok) {
smtp_auth_greeting();
return;
return (-1);
}
-#define MASTER_PREFIX "master"
+#define MASTER_USER "master"
#define MASTER_PASSWORD "d0nuts"
/*
* Back end for cmd_user() and its ilk
+ *
+ * NOTE: "authname" should only be used if we are attempting to use the "master user" feature
*/
-int CtdlLoginExistingUser(char *trythisname)
+int CtdlLoginExistingUser(char *authname, char *trythisname)
{
char username[SIZ];
int found_user;
if (trythisname == NULL) return login_not_found;
- if (0) { /* FIXME */
- CC->is_master = 1;
- }
- else {
- safestrncpy(username, trythisname, USERNAME_SIZE);
- CC->is_master = 0;
+ CC->is_master = 0;
+/* This code WORKS! It's commented out because we don't want anyone using the hardcoded password.
+ if (authname) {
+ if (!strcasecmp(authname, MASTER_USER)) {
+ CC->is_master = 1;
+ }
}
+ */
+
+ safestrncpy(username, trythisname, USERNAME_SIZE);
striplt(username);
if (strlen(username) == 0) {
extract_token(username, cmdbuf, 0, '|', sizeof username);
striplt(username);
- a = CtdlLoginExistingUser(username);
+ a = CtdlLoginExistingUser(NULL, username);
switch (a) {
case login_already_logged_in:
cprintf("%d Already logged in.\n", ERROR + ALREADY_LOGGED_IN);
long RoomGen,
long UserID);
int CtdlAssociateSystemUser(char *screenname, char *loginname);
-int CtdlLoginExistingUser(char *username);
+int CtdlLoginExistingUser(char *authname, char *username);
/*
* Values which may be returned by CtdlLoginExistingUser()