git://git.exim.org
/
exim.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Documentation and comment tidies.
[exim.git]
/
src
/
src
/
route.c
diff --git
a/src/src/route.c
b/src/src/route.c
index 3a36f8a8ec1bed05fd085d4f901fa543308e2e06..f80256e3e82f4128b06e973bcea1aafd3592ca1e 100644
(file)
--- a/
src/src/route.c
+++ b/
src/src/route.c
@@
-1,10
+1,10
@@
-/* $Cambridge: exim/src/src/route.c,v 1.
6 2005/09/12 15:09:5
5 ph10 Exp $ */
+/* $Cambridge: exim/src/src/route.c,v 1.
11 2006/10/09 14:36:2
5 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
*************************************************/
/*************************************************
* Exim - an Internet mail transport agent *
*************************************************/
-/* Copyright (c) University of Cambridge 1995 - 200
5
*/
+/* Copyright (c) University of Cambridge 1995 - 200
6
*/
/* See the file NOTICE for conditions of use and distribution. */
/* Functions concerned with routing, and the list of generic router options. */
/* See the file NOTICE for conditions of use and distribution. */
/* Functions concerned with routing, and the list of generic router options. */
@@
-1077,7
+1077,12
@@
static uschar lastshell[128];
BOOL
route_finduser(uschar *s, struct passwd **pw, uid_t *return_uid)
{
BOOL
route_finduser(uschar *s, struct passwd **pw, uid_t *return_uid)
{
-if (Ustrcmp(lastname, s) != 0)
+BOOL cache_set = (Ustrcmp(lastname, s) == 0);
+
+DEBUG(D_uid) debug_printf("seeking password data for user \"%s\": %s\n", s,
+ cache_set? "using cached result" : "cache not available");
+
+if (!cache_set)
{
int i = 0;
{
int i = 0;
@@
-1104,6
+1109,7
@@
if (Ustrcmp(lastname, s) != 0)
else for (;;)
{
else for (;;)
{
+ errno = 0;
if ((lastpw = getpwnam(CS s)) != NULL) break;
if (++i > finduser_retries) break;
sleep(1);
if ((lastpw = getpwnam(CS s)) != NULL) break;
if (++i > finduser_retries) break;
sleep(1);
@@
-1122,14
+1128,25
@@
if (Ustrcmp(lastname, s) != 0)
pwcopy.pw_shell = CS lastshell;
lastpw = &pwcopy;
}
pwcopy.pw_shell = CS lastshell;
lastpw = &pwcopy;
}
+
+ else DEBUG(D_uid)
+ {
+ if (errno != 0) debug_printf("getpwnam(%s) failed: %s\n", s,
+ strerror(errno));
+ }
+ }
+
+if (lastpw == NULL)
+ {
+ DEBUG(D_uid) debug_printf("getpwnam() returned NULL (user not found)\n");
+ return FALSE;
}
else
{
}
else
{
- DEBUG(D_uid) debug_printf("finduser used cached passwd data for %s\n", s);
+ DEBUG(D_uid) debug_printf("getpwnam() succeeded uid=%d gid=%d\n",
+ lastpw->pw_uid, lastpw->pw_gid);
}
}
-if (lastpw == NULL) return FALSE;
-
if (return_uid != NULL) *return_uid = lastpw->pw_uid;
if (pw != NULL) *pw = lastpw;
if (return_uid != NULL) *return_uid = lastpw->pw_uid;
if (pw != NULL) *pw = lastpw;
@@
-1854,7
+1871,7
@@
if (r->translate_ip_address != NULL)
DEBUG(D_route) debug_printf("%s [%s] translated to %s\n",
h->name, h->address, newaddress);
DEBUG(D_route) debug_printf("%s [%s] translated to %s\n",
h->name, h->address, newaddress);
- if (string_is_ip_address(newaddress, NULL)
>
0)
+ if (string_is_ip_address(newaddress, NULL)
!=
0)
{
h->address = newaddress;
continue;
{
h->address = newaddress;
continue;
@@
-1867,7
+1884,7
@@
if (r->translate_ip_address != NULL)
h->mx = MX_NONE;
store_pool = POOL_PERM;
h->mx = MX_NONE;
store_pool = POOL_PERM;
- rc = host_find_byname(h, NULL, NULL, TRUE);
+ rc = host_find_byname(h, NULL,
HOST_FIND_QUALIFY_SINGLE,
NULL, TRUE);
store_pool = old_pool;
if (rc == HOST_FIND_FAILED || rc == HOST_FIND_AGAIN)
store_pool = old_pool;
if (rc == HOST_FIND_FAILED || rc == HOST_FIND_AGAIN)