Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
mailutils
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
edfa04de
...
edfa04de0dd478c56beeed34054251f00cd74698
authored
2005-02-25 16:32:17 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
(cb_retrieve): Fall back to SQL if plaintext password file is not available.
1 parent
d924063f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
7 deletions
imap4d/auth_gsasl.c
imap4d/auth_gsasl.c
View file @
edfa04d
...
...
@@ -18,6 +18,9 @@
#include "imap4d.h"
#include <gsasl.h>
#include <mailutils/gsasl.h>
#ifdef USE_SQL
# include <mailutils/sql.h>
#endif
static
Gsasl_ctx
*
ctx
;
static
Gsasl_session_ctx
*
sess_ctx
;
...
...
@@ -262,11 +265,35 @@ cb_retrieve (Gsasl_session_ctx *ctx,
{
char
**
username
=
gsasl_server_application_data_get
(
ctx
);
if
(
username
&&
authentication_id
)
if
(
username
&&
*
username
==
0
&&
authentication_id
)
*
username
=
strdup
(
authentication_id
);
if
(
gsasl_cram_md5_pwd
&&
access
(
gsasl_cram_md5_pwd
,
R_OK
)
==
0
)
{
int
rc
=
gsasl_md5pwd_get_password
(
gsasl_cram_md5_pwd
,
authentication_id
,
key
,
keylen
);
if
(
rc
==
GSASL_OK
)
return
rc
;
}
#ifdef USE_SQL
if
(
mu_sql_password_type
==
password_plaintext
)
{
char
*
passwd
;
int
status
=
mu_sql_getpass
(
username
,
&
passwd
);
if
(
status
==
0
)
{
*
keylen
=
strlen
(
passwd
);
if
(
key
)
memcpy
(
key
,
passwd
,
*
keylen
);
free
(
passwd
);
return
GSASL_OK
;
}
}
#endif
return
gsasl_md5pwd_get_password
(
gsasl_cram_md5_pwd
,
authentication_id
,
key
,
keylen
);
return
GSASL_AUTHENTICATION_ERROR
;
}
void
...
...
@@ -286,10 +313,7 @@ auth_gsasl_init ()
gsasl_server_callback_validate_set
(
ctx
,
cb_validate
);
gsasl_server_callback_service_set
(
ctx
,
cb_service
);
if
(
gsasl_cram_md5_pwd
&&
access
(
gsasl_cram_md5_pwd
,
R_OK
)
==
0
)
{
gsasl_server_callback_retrieve_set
(
ctx
,
cb_retrieve
);
}
gsasl_server_callback_retrieve_set
(
ctx
,
cb_retrieve
);
auth_gsasl_capa_init
(
0
);
}
...
...
Please
register
or
sign in
to post a comment