queue.c (77349) | queue.c (80785) |
---|---|
1/* 2 * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers. 3 * All rights reserved. 4 * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved. 5 * Copyright (c) 1988, 1993 6 * The Regents of the University of California. All rights reserved. 7 * 8 * By using this file, you agree to the terms and conditions set 9 * forth in the LICENSE file which can be found at the top level of 10 * the sendmail distribution. 11 * 12 */ 13 14 15#include <sendmail.h> 16 17#ifndef lint 18# if QUEUE | 1/* 2 * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers. 3 * All rights reserved. 4 * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved. 5 * Copyright (c) 1988, 1993 6 * The Regents of the University of California. All rights reserved. 7 * 8 * By using this file, you agree to the terms and conditions set 9 * forth in the LICENSE file which can be found at the top level of 10 * the sendmail distribution. 11 * 12 */ 13 14 15#include <sendmail.h> 16 17#ifndef lint 18# if QUEUE |
19static char id[] = "@(#)$Id: queue.c,v 8.343.4.55 2001/05/03 23:37:11 gshapiro Exp $ (with queueing)"; | 19static char id[] = "@(#)$Id: queue.c,v 8.343.4.62 2001/07/20 00:53:01 gshapiro Exp $ (with queueing)"; |
20# else /* QUEUE */ | 20# else /* QUEUE */ |
21static char id[] = "@(#)$Id: queue.c,v 8.343.4.55 2001/05/03 23:37:11 gshapiro Exp $ (without queueing)"; | 21static char id[] = "@(#)$Id: queue.c,v 8.343.4.62 2001/07/20 00:53:01 gshapiro Exp $ (without queueing)"; |
22# endif /* QUEUE */ 23#endif /* ! lint */ 24 25# include <dirent.h> 26 27#if QUEUE 28 29# if _FFR_QUEUEDELAY --- 33 unchanged lines hidden (view full) --- 63static char *strrev __P((char *)); 64static ADDRESS *setctluser __P((char *, int)); 65static int workcmpf0(); 66static int workcmpf1(); 67static int workcmpf2(); 68static int workcmpf3(); 69static int workcmpf4(); 70 | 22# endif /* QUEUE */ 23#endif /* ! lint */ 24 25# include <dirent.h> 26 27#if QUEUE 28 29# if _FFR_QUEUEDELAY --- 33 unchanged lines hidden (view full) --- 63static char *strrev __P((char *)); 64static ADDRESS *setctluser __P((char *, int)); 65static int workcmpf0(); 66static int workcmpf1(); 67static int workcmpf2(); 68static int workcmpf3(); 69static int workcmpf4(); 70 |
71/* 72** Current qf file field assignments: 73** 74** A AUTH= parameter 75** B body type 76** C controlling user 77** D data file name 78** E error recipient 79** F flag bits 80** G queue delay algorithm 81** H header 82** I data file's inode number 83** K time of last delivery attempt 84** L Solaris Content-Length: header (obsolete) 85** M message (obsolete) 86** N number of delivery attempts 87** P message priority 88** Q original recipient (ORCPT=) 89** R recipient 90** S sender 91** T init time 92** V queue file version 93** X character set (_FFR_SAVE_CHARSET) 94** Y current delay 95** Z original envelope id from ESMTP 96** $ define macro 97** . terminate file 98*/ 99 |
|
71/* 72** QUEUEUP -- queue a message up for future transmission. 73** 74** Parameters: 75** e -- the envelope to queue up. 76** announce -- if TRUE, tell when you are queueing up. 77** 78** Returns: --- 290 unchanged lines hidden (view full) --- 369 { 370 if (!QS_IS_UNDELIVERED(q->q_state)) 371 continue; 372 373 printctladdr(q, tfp); 374 if (q->q_orcpt != NULL) 375 fprintf(tfp, "Q%s\n", 376 denlstring(q->q_orcpt, TRUE, FALSE)); | 100/* 101** QUEUEUP -- queue a message up for future transmission. 102** 103** Parameters: 104** e -- the envelope to queue up. 105** announce -- if TRUE, tell when you are queueing up. 106** 107** Returns: --- 290 unchanged lines hidden (view full) --- 398 { 399 if (!QS_IS_UNDELIVERED(q->q_state)) 400 continue; 401 402 printctladdr(q, tfp); 403 if (q->q_orcpt != NULL) 404 fprintf(tfp, "Q%s\n", 405 denlstring(q->q_orcpt, TRUE, FALSE)); |
406 |
|
377 (void) putc('R', tfp); 378 if (bitset(QPRIMARY, q->q_flags)) 379 (void) putc('P', tfp); 380 if (bitset(QHASNOTIFY, q->q_flags)) 381 (void) putc('N', tfp); 382 if (bitset(QPINGONSUCCESS, q->q_flags)) 383 (void) putc('S', tfp); 384 if (bitset(QPINGONFAILURE, q->q_flags)) --- 1761 unchanged lines hidden (view full) --- 2146 case 'T': /* init time */ 2147 e->e_ctime = atol(&bp[1]); 2148 break; 2149 2150 case 'I': /* data file's inode number */ 2151 /* regenerated below */ 2152 break; 2153 | 407 (void) putc('R', tfp); 408 if (bitset(QPRIMARY, q->q_flags)) 409 (void) putc('P', tfp); 410 if (bitset(QHASNOTIFY, q->q_flags)) 411 (void) putc('N', tfp); 412 if (bitset(QPINGONSUCCESS, q->q_flags)) 413 (void) putc('S', tfp); 414 if (bitset(QPINGONFAILURE, q->q_flags)) --- 1761 unchanged lines hidden (view full) --- 2176 case 'T': /* init time */ 2177 e->e_ctime = atol(&bp[1]); 2178 break; 2179 2180 case 'I': /* data file's inode number */ 2181 /* regenerated below */ 2182 break; 2183 |
2154 case 'K': /* time of last delivery attempt */ | 2184 case 'K': /* time of last delivery attempt */ |
2155 e->e_dtime = atol(&buf[1]); 2156 break; 2157 2158# if _FFR_QUEUEDELAY | 2185 e->e_dtime = atol(&buf[1]); 2186 break; 2187 2188# if _FFR_QUEUEDELAY |
2159 case 'G': /* queue delay algorithm */ | 2189 case 'G': /* queue delay algorithm */ |
2160 e->e_queuealg = atoi(&buf[1]); 2161 break; | 2190 e->e_queuealg = atoi(&buf[1]); 2191 break; |
2162 case 'Y': /* current delay */ | 2192 case 'Y': /* current delay */ |
2163 e->e_queuedelay = (time_t) atol(&buf[1]); 2164 break; 2165# endif /* _FFR_QUEUEDELAY */ 2166 2167 case 'N': /* number of delivery attempts */ 2168 e->e_ntries = atoi(&buf[1]); 2169 2170 /* if this has been tried recently, let it be */ --- 757 unchanged lines hidden (view full) --- 2928 a->q_user = newstr(user); 2929 if (qfver >= 2) 2930 { 2931 if ((p = strtok(NULL, ":")) != NULL) 2932 a->q_uid = atoi(p); 2933 if ((p = strtok(NULL, ":")) != NULL) 2934 a->q_gid = atoi(p); 2935 if ((p = strtok(NULL, ":")) != NULL) | 2193 e->e_queuedelay = (time_t) atol(&buf[1]); 2194 break; 2195# endif /* _FFR_QUEUEDELAY */ 2196 2197 case 'N': /* number of delivery attempts */ 2198 e->e_ntries = atoi(&buf[1]); 2199 2200 /* if this has been tried recently, let it be */ --- 757 unchanged lines hidden (view full) --- 2958 a->q_user = newstr(user); 2959 if (qfver >= 2) 2960 { 2961 if ((p = strtok(NULL, ":")) != NULL) 2962 a->q_uid = atoi(p); 2963 if ((p = strtok(NULL, ":")) != NULL) 2964 a->q_gid = atoi(p); 2965 if ((p = strtok(NULL, ":")) != NULL) |
2966 { 2967 char *o; 2968 |
|
2936 a->q_flags |= QGOODUID; | 2969 a->q_flags |= QGOODUID; |
2970 2971 /* if there is another ':': restore it */ 2972 if ((o = strtok(NULL, ":")) != NULL && o > p) 2973 o[-1] = ':'; 2974 } |
|
2937 } 2938 else if ((pw = sm_getpwnam(user)) != NULL) 2939 { 2940 if (*pw->pw_dir == '\0') 2941 a->q_home = NULL; 2942 else if (strcmp(pw->pw_dir, "/") == 0) 2943 a->q_home = ""; 2944 else --- 136 unchanged lines hidden (view full) --- 3081 if (e->e_queuedir != NOQDIR) 3082 { 3083 if (tTd(41, 20)) 3084 dprintf("setnewqueue: e_queuedir already assigned (%s)\n", 3085 qid_printqueue(e->e_queuedir)); 3086 return; 3087 } 3088 | 2975 } 2976 else if ((pw = sm_getpwnam(user)) != NULL) 2977 { 2978 if (*pw->pw_dir == '\0') 2979 a->q_home = NULL; 2980 else if (strcmp(pw->pw_dir, "/") == 0) 2981 a->q_home = ""; 2982 else --- 136 unchanged lines hidden (view full) --- 3119 if (e->e_queuedir != NOQDIR) 3120 { 3121 if (tTd(41, 20)) 3122 dprintf("setnewqueue: e_queuedir already assigned (%s)\n", 3123 qid_printqueue(e->e_queuedir)); 3124 return; 3125 } 3126 |
3089 if (NumQueues == 1) | 3127 if (NumQueues <= 1) |
3090 idx = 0; 3091 else 3092 { 3093#if RANDOMSHIFT 3094 /* lower bits are not random "enough", select others */ 3095 idx = (get_random() >> RANDOMSHIFT) % NumQueues; 3096#else /* RANDOMSHIFT */ 3097 idx = get_random() % NumQueues; --- 372 unchanged lines hidden --- | 3128 idx = 0; 3129 else 3130 { 3131#if RANDOMSHIFT 3132 /* lower bits are not random "enough", select others */ 3133 idx = (get_random() >> RANDOMSHIFT) % NumQueues; 3134#else /* RANDOMSHIFT */ 3135 idx = get_random() % NumQueues; --- 372 unchanged lines hidden --- |