19536Seric #include <pwd.h> 29536Seric #include <time.h> 39536Seric #include "sendmail.h" 49536Seric #include <sys/stat.h> 59536Seric 6*9582Seric SCCSID(@(#)envelope.c 3.2 12/09/82); 79536Seric 89536Seric /* 99536Seric ** NEWENVELOPE -- allocate a new envelope 109536Seric ** 119536Seric ** Supports inheritance. 129536Seric ** 139536Seric ** Parameters: 149536Seric ** e -- the new envelope to fill in. 159536Seric ** 169536Seric ** Returns: 179536Seric ** e. 189536Seric ** 199536Seric ** Side Effects: 209536Seric ** none. 219536Seric */ 229536Seric 239536Seric ENVELOPE * 249536Seric newenvelope(e) 259536Seric register ENVELOPE *e; 269536Seric { 279536Seric register HDR *bh; 289536Seric register HDR **nhp; 299536Seric register ENVELOPE *parent; 309536Seric extern putheader(), putbody(); 319536Seric extern ENVELOPE BlankEnvelope; 329536Seric 339536Seric parent = CurEnv; 349536Seric if (e == CurEnv) 359536Seric parent = e->e_parent; 369536Seric clear((char *) e, sizeof *e); 379536Seric bmove((char *) &CurEnv->e_from, (char *) &e->e_from, sizeof e->e_from); 389536Seric e->e_parent = parent; 399536Seric e->e_ctime = curtime(); 409536Seric e->e_puthdr = putheader; 419536Seric e->e_putbody = putbody; 429536Seric bh = BlankEnvelope.e_header; 439536Seric nhp = &e->e_header; 449536Seric while (bh != NULL) 459536Seric { 469536Seric *nhp = (HDR *) xalloc(sizeof *bh); 479536Seric bmove((char *) bh, (char *) *nhp, sizeof *bh); 489536Seric bh = bh->h_link; 499536Seric nhp = &(*nhp)->h_link; 509536Seric } 519536Seric if (CurEnv->e_xfp != NULL) 529536Seric (void) fflush(CurEnv->e_xfp); 539536Seric 549536Seric return (e); 559536Seric } 569536Seric /* 579536Seric ** DROPENVELOPE -- deallocate an envelope. 589536Seric ** 599536Seric ** Parameters: 609536Seric ** e -- the envelope to deallocate. 619536Seric ** 629536Seric ** Returns: 639536Seric ** none. 649536Seric ** 659536Seric ** Side Effects: 669536Seric ** housekeeping necessary to dispose of an envelope. 679536Seric ** Unlocks this queue file. 689536Seric */ 699536Seric 709536Seric dropenvelope(e) 719536Seric register ENVELOPE *e; 729536Seric { 739536Seric bool queueit = FALSE; 749536Seric register ADDRESS *q; 759536Seric 769536Seric #ifdef DEBUG 779536Seric if (tTd(50, 1)) 789536Seric { 799536Seric printf("dropenvelope %x id=", e); 809536Seric xputs(e->e_id); 819536Seric printf(" flags=%o\n", e->e_flags); 829536Seric } 839536Seric #endif DEBUG 849536Seric #ifdef LOG 859536Seric if (LogLevel > 10) 869536Seric syslog(LOG_DEBUG, "dropenvelope, id=%s, flags=%o, pid=%d", 879536Seric e->e_id == NULL ? "(none)" : e->e_id, 889536Seric e->e_flags, getpid()); 899536Seric #endif LOG 909536Seric 919536Seric /* we must have an id to remove disk files */ 929536Seric if (e->e_id == NULL) 939536Seric return; 949536Seric 959536Seric /* 969536Seric ** Extract state information from dregs of send list. 979536Seric */ 989536Seric 999536Seric for (q = e->e_sendqueue; q != NULL; q = q->q_next) 1009536Seric { 1019536Seric if (bitset(QQUEUEUP, q->q_flags)) 1029536Seric queueit = TRUE; 1039536Seric } 1049536Seric 1059536Seric /* 1069536Seric ** Send back return receipts as requested. 1079536Seric */ 1089536Seric 1099536Seric if (e->e_receiptto != NULL && bitset(EF_SENDRECEIPT, e->e_flags)) 1109536Seric { 1119536Seric auto ADDRESS *rlist; 1129536Seric 1139536Seric sendto(CurEnv->e_receiptto, (ADDRESS *) NULL, &rlist); 1149536Seric (void) returntosender("Return receipt", rlist, FALSE); 1159536Seric } 1169536Seric 1179536Seric /* 1189536Seric ** See if this message has timed out 1199536Seric */ 1209536Seric 1219536Seric if (bitset(EF_TIMEOUT, e->e_flags) && queueit) 1229536Seric timeout(e); 1239536Seric 1249536Seric /* 1259536Seric ** Arrange to send error messages if there are fatal errors. 1269536Seric */ 1279536Seric 1289536Seric if (bitset(EF_FATALERRS, e->e_flags)) 1299536Seric savemail(e); 1309536Seric 1319536Seric /* 1329536Seric ** Instantiate or deinstantiate the queue. 1339536Seric */ 1349536Seric 1359536Seric if ((!queueit && !bitset(EF_KEEPQUEUE, e->e_flags)) || 1369536Seric bitset(EF_CLRQUEUE, e->e_flags)) 1379536Seric { 1389536Seric if (e->e_dfp != NULL) 1399536Seric (void) fclose(e->e_dfp); 1409536Seric if (e->e_df != NULL) 1419536Seric xunlink(e->e_df); 1429536Seric xunlink(queuename(e, 'q')); 1439536Seric } 1449536Seric else if (queueit || !bitset(EF_INQUEUE, e->e_flags)) 1459536Seric queueup(e, FALSE, FALSE); 1469536Seric 1479536Seric /* now unlock the job */ 1489536Seric if (e->e_xfp != NULL) 1499536Seric (void) fclose(e->e_xfp); 1509536Seric unlockqueue(e); 1519536Seric 1529536Seric /* make sure that this envelope is marked unused */ 1539536Seric e->e_id = e->e_df = NULL; 1549536Seric e->e_dfp = e->e_xfp = NULL; 1559536Seric } 1569536Seric /* 1579536Seric ** CLEARENVELOPE -- clear an envelope without unlocking 1589536Seric ** 1599536Seric ** This is normally used by a child process to get a clean 1609536Seric ** envelope without disturbing the parent. 1619536Seric ** 1629536Seric ** Parameters: 1639536Seric ** e -- the envelope to clear. 1649536Seric ** 1659536Seric ** Returns: 1669536Seric ** none. 1679536Seric ** 1689536Seric ** Side Effects: 1699536Seric ** Closes files associated with the envelope. 1709536Seric ** Marks the envelope as unallocated. 1719536Seric */ 1729536Seric 1739536Seric clearenvelope(e) 1749536Seric register ENVELOPE *e; 1759536Seric { 1769536Seric /* clear out any file information */ 1779536Seric if (e->e_xfp != NULL) 1789536Seric (void) fclose(e->e_xfp); 1799536Seric if (e->e_dfp != NULL) 1809536Seric (void) fclose(e->e_dfp); 1819536Seric e->e_xfp = e->e_dfp = NULL; 1829536Seric 1839536Seric /* now expunge names of objects */ 1849536Seric e->e_df = e->e_id = NULL; 1859536Seric 1869536Seric /* and the flags which are now meaningless */ 1879536Seric e->e_flags = 0; 1889536Seric } 1899536Seric /* 1909536Seric ** UNLOCKQUEUE -- unlock the queue entry for a specified envelope 1919536Seric ** 1929536Seric ** Parameters: 1939536Seric ** e -- the envelope to unlock. 1949536Seric ** 1959536Seric ** Returns: 1969536Seric ** none 1979536Seric ** 1989536Seric ** Side Effects: 1999536Seric ** unlocks the queue for `e'. 2009536Seric */ 2019536Seric 2029536Seric unlockqueue(e) 2039536Seric ENVELOPE *e; 2049536Seric { 2059536Seric /* remove the transcript */ 2069536Seric #ifdef DEBUG 2079536Seric if (!tTd(51, 4)) 2089536Seric #endif DEBUG 2099536Seric xunlink(queuename(e, 'x')); 2109536Seric 2119536Seric /* last but not least, remove the lock */ 2129536Seric xunlink(queuename(e, 'l')); 2139536Seric } 2149536Seric /* 2159536Seric ** INITSYS -- initialize instantiation of system 2169536Seric ** 2179536Seric ** In Daemon mode, this is done in the child. 2189536Seric ** 2199536Seric ** Parameters: 2209536Seric ** none. 2219536Seric ** 2229536Seric ** Returns: 2239536Seric ** none. 2249536Seric ** 2259536Seric ** Side Effects: 2269536Seric ** Initializes the system macros, some global variables, 2279536Seric ** etc. In particular, the current time in various 2289536Seric ** forms is set. 2299536Seric */ 2309536Seric 2319536Seric initsys() 2329536Seric { 2339536Seric auto time_t now; 2349536Seric static char cbuf[5]; /* holds hop count */ 2359536Seric static char dbuf[30]; /* holds ctime(tbuf) */ 2369536Seric static char pbuf[10]; /* holds pid */ 2379536Seric static char tbuf[20]; /* holds "current" time */ 2389536Seric static char ybuf[10]; /* holds tty id */ 2399536Seric register char *p; 2409536Seric register struct tm *tm; 2419536Seric extern char *ttyname(); 2429536Seric extern char *arpadate(); 2439536Seric extern struct tm *gmtime(); 2449536Seric extern char *macvalue(); 2459536Seric extern char Version[]; 2469536Seric 2479536Seric /* 2489536Seric ** Give this envelope a reality. 2499536Seric ** I.e., an id, a transcript, and a creation time. 2509536Seric */ 2519536Seric 2529536Seric openxscript(CurEnv); 2539536Seric CurEnv->e_ctime = curtime(); 2549536Seric 2559536Seric /* 2569536Seric ** Set OutChannel to something useful if stdout isn't it. 2579536Seric ** This arranges that any extra stuff the mailer produces 2589536Seric ** gets sent back to the user on error (because it is 2599536Seric ** tucked away in the transcript). 2609536Seric */ 2619536Seric 2629536Seric if (OpMode == MD_DAEMON && QueueRun) 2639536Seric OutChannel = CurEnv->e_xfp; 2649536Seric 2659536Seric /* 2669536Seric ** Set up some basic system macros. 2679536Seric */ 2689536Seric 2699536Seric /* process id */ 2709536Seric (void) sprintf(pbuf, "%d", getpid()); 2719536Seric define('p', pbuf, CurEnv); 2729536Seric 2739536Seric /* hop count */ 2749536Seric (void) sprintf(cbuf, "%d", CurEnv->e_hopcount); 2759536Seric define('c', cbuf, CurEnv); 2769536Seric 2779536Seric /* time as integer, unix time, arpa time */ 2789536Seric now = curtime(); 2799536Seric tm = gmtime(&now); 2809536Seric (void) sprintf(tbuf, "%02d%02d%02d%02d%02d", tm->tm_year, tm->tm_mon, 2819536Seric tm->tm_mday, tm->tm_hour, tm->tm_min); 2829536Seric define('t', tbuf, CurEnv); 2839536Seric (void) strcpy(dbuf, ctime(&now)); 2849536Seric *index(dbuf, '\n') = '\0'; 2859536Seric if (macvalue('d', CurEnv) == NULL) 2869536Seric define('d', dbuf, CurEnv); 2879536Seric p = newstr(arpadate(dbuf)); 2889536Seric if (macvalue('a', CurEnv) == NULL) 2899536Seric define('a', p, CurEnv); 2909536Seric define('b', p, CurEnv); 2919536Seric 2929536Seric /* version */ 2939536Seric define('v', Version, CurEnv); 2949536Seric 2959536Seric /* tty name */ 2969536Seric if (macvalue('y', CurEnv) == NULL) 2979536Seric { 2989536Seric p = ttyname(2); 2999536Seric if (p != NULL) 3009536Seric { 3019536Seric if (rindex(p, '/') != NULL) 3029536Seric p = rindex(p, '/') + 1; 3039536Seric (void) strcpy(ybuf, p); 3049536Seric define('y', ybuf, CurEnv); 3059536Seric } 3069536Seric } 3079536Seric } 3089536Seric /* 3099536Seric ** QUEUENAME -- build a file name in the queue directory for this envelope. 3109536Seric ** 3119536Seric ** Assigns an id code if one does not already exist. 3129536Seric ** This code is very careful to avoid trashing existing files 3139536Seric ** under any circumstances. 3149536Seric ** We first create an nf file that is only used when 3159536Seric ** assigning an id. This file is always empty, so that 3169536Seric ** we can never accidently truncate an lf file. 3179536Seric ** 3189536Seric ** Parameters: 3199536Seric ** e -- envelope to build it in/from. 3209536Seric ** type -- the file type, used as the first character 3219536Seric ** of the file name. 3229536Seric ** 3239536Seric ** Returns: 3249536Seric ** a pointer to the new file name (in a static buffer). 3259536Seric ** 3269536Seric ** Side Effects: 3279536Seric ** Will create the lf and qf files if no id code is 3289536Seric ** already assigned. This will cause the envelope 3299536Seric ** to be modified. 3309536Seric */ 3319536Seric 3329536Seric char * 3339536Seric queuename(e, type) 3349536Seric register ENVELOPE *e; 3359536Seric char type; 3369536Seric { 3379536Seric static char buf[MAXNAME]; 3389536Seric static int pid = -1; 3399536Seric char c1 = 'A'; 3409536Seric char c2 = 'A'; 3419536Seric 3429536Seric if (e->e_id == NULL) 3439536Seric { 3449536Seric char qf[20]; 3459536Seric char lf[20]; 3469536Seric char nf[20]; 3479536Seric 3489536Seric /* find a unique id */ 3499536Seric if (pid != getpid()) 3509536Seric { 3519536Seric /* new process -- start back at "AA" */ 3529536Seric pid = getpid(); 3539536Seric c1 = 'A'; 3549536Seric c2 = 'A' - 1; 3559536Seric } 3569536Seric (void) sprintf(qf, "qfAA%05d", pid); 3579536Seric strcpy(lf, qf); 3589536Seric lf[0] = 'l'; 3599536Seric strcpy(nf, qf); 3609536Seric nf[0] = 'n'; 3619536Seric 3629536Seric while (c1 < '~' || c2 < 'Z') 3639536Seric { 3649536Seric int i; 3659536Seric 3669536Seric if (c2 >= 'Z') 3679536Seric { 3689536Seric c1++; 3699536Seric c2 = 'A' - 1; 3709536Seric } 3719536Seric qf[2] = lf[2] = nf[2] = c1; 3729536Seric qf[3] = lf[3] = nf[3] = ++c2; 3739536Seric # ifdef DEBUG 3749536Seric if (tTd(7, 20)) 3759536Seric printf("queuename: trying \"%s\"\n", nf); 3769536Seric # endif DEBUG 3779536Seric if (access(lf, 0) >= 0 || access(qf, 0) >= 0) 3789536Seric continue; 3799536Seric errno = 0; 3809536Seric i = creat(nf, FileMode); 3819536Seric if (i < 0) 3829536Seric { 3839536Seric (void) unlink(nf); /* kernel bug */ 3849536Seric continue; 3859536Seric } 3869536Seric (void) close(i); 3879536Seric i = link(nf, lf); 3889536Seric (void) unlink(nf); 3899536Seric if (i < 0) 3909536Seric continue; 3919536Seric if (link(lf, qf) >= 0) 3929536Seric break; 3939536Seric (void) unlink(lf); 3949536Seric } 3959536Seric if (c1 >= '~' && c2 >= 'Z') 3969536Seric { 3979536Seric syserr("queuename: Cannot create \"%s\" in \"%s\"", 3989536Seric lf, QueueDir); 3999536Seric exit(EX_OSERR); 4009536Seric } 4019536Seric e->e_id = newstr(&qf[2]); 4029536Seric define('i', e->e_id, e); 4039536Seric # ifdef DEBUG 4049536Seric if (tTd(7, 1)) 4059536Seric printf("queuename: assigned id %s, env=%x\n", e->e_id, e); 4069536Seric # endif DEBUG 4079536Seric } 4089536Seric 4099536Seric if (type == '\0') 4109536Seric return (NULL); 4119536Seric (void) sprintf(buf, "%cf%s", type, e->e_id); 4129536Seric # ifdef DEBUG 4139536Seric if (tTd(7, 2)) 4149536Seric printf("queuename: %s\n", buf); 4159536Seric # endif DEBUG 4169536Seric return (buf); 4179536Seric } 4189536Seric /* 4199536Seric ** OPENXSCRIPT -- Open transcript file 4209536Seric ** 4219536Seric ** Creates a transcript file for possible eventual mailing or 4229536Seric ** sending back. 4239536Seric ** 4249536Seric ** Parameters: 4259536Seric ** e -- the envelope to create the transcript in/for. 4269536Seric ** 4279536Seric ** Returns: 4289536Seric ** none 4299536Seric ** 4309536Seric ** Side Effects: 4319536Seric ** Creates the transcript file. 4329536Seric */ 4339536Seric 4349536Seric openxscript(e) 4359536Seric register ENVELOPE *e; 4369536Seric { 4379536Seric register char *p; 4389536Seric 4399536Seric if (e->e_xfp != NULL) 4409536Seric return; 4419536Seric p = queuename(e, 'x'); 4429536Seric e->e_xfp = fopen(p, "w"); 4439536Seric if (e->e_xfp == NULL) 4449536Seric syserr("Can't create %s", p); 4459536Seric else 4469536Seric (void) chmod(p, 0644); 4479536Seric } 4489536Seric /* 4499536Seric ** SETSENDER -- set the person who this message is from 4509536Seric ** 4519536Seric ** Under certain circumstances allow the user to say who 4529536Seric ** s/he is (using -f or -r). These are: 4539536Seric ** 1. The user's uid is zero (root). 4549536Seric ** 2. The user's login name is in an approved list (typically 4559536Seric ** from a network server). 4569536Seric ** 3. The address the user is trying to claim has a 4579536Seric ** "!" character in it (since #2 doesn't do it for 4589536Seric ** us if we are dialing out for UUCP). 4599536Seric ** A better check to replace #3 would be if the 4609536Seric ** effective uid is "UUCP" -- this would require me 4619536Seric ** to rewrite getpwent to "grab" uucp as it went by, 4629536Seric ** make getname more nasty, do another passwd file 4639536Seric ** scan, or compile the UID of "UUCP" into the code, 4649536Seric ** all of which are reprehensible. 4659536Seric ** 4669536Seric ** Assuming all of these fail, we figure out something 4679536Seric ** ourselves. 4689536Seric ** 4699536Seric ** Parameters: 4709536Seric ** from -- the person we would like to believe this message 4719536Seric ** is from, as specified on the command line. 4729536Seric ** 4739536Seric ** Returns: 4749536Seric ** none. 4759536Seric ** 4769536Seric ** Side Effects: 4779536Seric ** sets sendmail's notion of who the from person is. 4789536Seric */ 4799536Seric 4809536Seric setsender(from) 4819536Seric char *from; 4829536Seric { 4839536Seric register char **pvp; 4849536Seric register struct passwd *pw = NULL; 4859536Seric char *realname = NULL; 4869536Seric char buf[MAXNAME]; 4879536Seric extern char *macvalue(); 4889536Seric extern char **prescan(); 4899536Seric extern bool safefile(); 4909536Seric extern char *FullName; 4919536Seric 4929536Seric # ifdef DEBUG 4939536Seric if (tTd(45, 1)) 4949536Seric printf("setsender(%s)\n", from); 4959536Seric # endif DEBUG 4969536Seric 4979536Seric /* 4989536Seric ** Figure out the real user executing us. 4999536Seric ** Username can return errno != 0 on non-errors. 5009536Seric */ 5019536Seric 5029536Seric if (QueueRun || OpMode == MD_SMTP || OpMode == MD_ARPAFTP) 5039536Seric realname = from; 5049536Seric if (realname == NULL || realname[0] == '\0') 5059536Seric { 5069536Seric extern char *username(); 5079536Seric 5089536Seric realname = username(); 5099536Seric errno = 0; 5109536Seric } 5119536Seric if (realname == NULL || realname[0] == '\0') 5129536Seric { 5139536Seric extern struct passwd *getpwuid(); 5149536Seric 5159536Seric pw = getpwuid(getruid()); 5169536Seric if (pw != NULL) 5179536Seric realname = pw->pw_name; 5189536Seric } 5199536Seric if (realname == NULL || realname[0] == '\0') 5209536Seric { 5219536Seric syserr("Who are you?"); 5229536Seric realname = "root"; 5239536Seric } 5249536Seric 5259536Seric /* 5269536Seric ** Determine if this real person is allowed to alias themselves. 5279536Seric */ 5289536Seric 5299536Seric if (from != NULL) 5309536Seric { 5319536Seric extern bool trusteduser(); 5329536Seric 5339536Seric if (!trusteduser(realname) && 5349536Seric # ifdef DEBUG 5359536Seric (!tTd(1, 9) || getuid() != geteuid()) && 5369536Seric # endif DEBUG 5379536Seric index(from, '!') == NULL && getuid() != 0) 5389536Seric { 5399536Seric /* network sends -r regardless (why why why?) */ 5409536Seric /* syserr("%s, you cannot use the -f flag", realname); */ 5419536Seric from = NULL; 5429536Seric } 5439536Seric } 5449536Seric 5459536Seric SuprErrs = TRUE; 5469536Seric if (from == NULL || parse(from, &CurEnv->e_from, 1) == NULL) 5479536Seric { 5489536Seric from = newstr(realname); 5499536Seric (void) parse(from, &CurEnv->e_from, 1); 5509536Seric } 5519536Seric else 5529536Seric FromFlag = TRUE; 5539536Seric CurEnv->e_from.q_flags |= QDONTSEND; 5549536Seric SuprErrs = FALSE; 5559536Seric 5569536Seric if (pw == NULL && CurEnv->e_from.q_mailer == LocalMailer) 5579536Seric { 5589536Seric extern struct passwd *getpwnam(); 5599536Seric 5609536Seric pw = getpwnam(CurEnv->e_from.q_user); 5619536Seric } 5629536Seric 5639536Seric /* 5649536Seric ** Process passwd file entry. 5659536Seric */ 5669536Seric 5679536Seric if (pw != NULL) 5689536Seric { 5699536Seric /* extract home directory */ 5709536Seric CurEnv->e_from.q_home = newstr(pw->pw_dir); 5719536Seric 5729536Seric /* run user's .mailcf file */ 5739536Seric define('z', CurEnv->e_from.q_home, CurEnv); 5749536Seric expand("$z/.mailcf", buf, &buf[sizeof buf - 1], CurEnv); 5759536Seric if (safefile(buf, getruid(), S_IREAD)) 5769536Seric readcf(buf, FALSE); 5779536Seric 5789536Seric /* if the user has given fullname already, don't redefine */ 5799536Seric if (FullName == NULL) 5809536Seric FullName = macvalue('x', CurEnv); 5819536Seric if (FullName[0] == '\0') 5829536Seric FullName = NULL; 5839536Seric 5849536Seric /* extract full name from passwd file */ 585*9582Seric if (FullName == NULL && pw->pw_gecos != NULL && 586*9582Seric strcmp(pw->pw_name, CurEnv->e_from.q_user) == 0) 5879536Seric { 5889536Seric buildfname(pw->pw_gecos, CurEnv->e_from.q_user, buf); 5899536Seric if (buf[0] != '\0') 5909536Seric FullName = newstr(buf); 5919536Seric } 5929536Seric if (FullName != NULL) 5939536Seric define('x', FullName, CurEnv); 5949536Seric } 5959536Seric 5969536Seric #ifndef V6 5979536Seric if (CurEnv->e_from.q_home == NULL) 5989536Seric CurEnv->e_from.q_home = getenv("HOME"); 5999536Seric #endif V6 6009536Seric CurEnv->e_from.q_uid = getuid(); 6019536Seric CurEnv->e_from.q_gid = getgid(); 6029536Seric if (CurEnv->e_from.q_uid != 0) 6039536Seric { 6049536Seric DefUid = CurEnv->e_from.q_uid; 6059536Seric DefGid = CurEnv->e_from.q_gid; 6069536Seric } 6079536Seric 6089536Seric /* 6099536Seric ** Rewrite the from person to dispose of possible implicit 6109536Seric ** links in the net. 6119536Seric */ 6129536Seric 6139536Seric pvp = prescan(from, '\0'); 6149536Seric if (pvp == NULL) 6159536Seric { 6169536Seric syserr("cannot prescan from (%s)", from); 6179536Seric finis(); 6189536Seric } 6199536Seric rewrite(pvp, 3); 6209536Seric rewrite(pvp, 1); 6219536Seric cataddr(pvp, buf, sizeof buf); 6229536Seric define('f', newstr(buf), CurEnv); 6239536Seric 6249536Seric /* save the domain spec if this mailer wants it */ 6259536Seric if (bitset(M_CANONICAL, CurEnv->e_from.q_mailer->m_flags)) 6269536Seric { 6279536Seric extern char **copyplist(); 6289536Seric 6299536Seric while (*pvp != NULL && strcmp(*pvp, "@") != 0) 6309536Seric pvp++; 6319536Seric if (*pvp != NULL) 6329536Seric CurEnv->e_fromdomain = copyplist(pvp, TRUE); 6339536Seric } 6349536Seric } 6359536Seric /* 6369536Seric ** TRUSTEDUSER -- tell us if this user is to be trusted. 6379536Seric ** 6389536Seric ** Parameters: 6399536Seric ** user -- the user to be checked. 6409536Seric ** 6419536Seric ** Returns: 6429536Seric ** TRUE if the user is in an approved list. 6439536Seric ** FALSE otherwise. 6449536Seric ** 6459536Seric ** Side Effects: 6469536Seric ** none. 6479536Seric */ 6489536Seric 6499536Seric bool 6509536Seric trusteduser(user) 6519536Seric char *user; 6529536Seric { 6539536Seric register char **ulist; 6549536Seric extern char *TrustedUsers[]; 6559536Seric 6569536Seric for (ulist = TrustedUsers; *ulist != NULL; ulist++) 6579536Seric if (strcmp(*ulist, user) == 0) 6589536Seric return (TRUE); 6599536Seric return (FALSE); 6609536Seric } 661