003 File Manager
Current Path:
/usr/src/contrib/sendmail/src
usr
/
src
/
contrib
/
sendmail
/
src
/
📁
..
📄
Makefile
(347 B)
📄
Makefile.m4
(4.37 KB)
📄
README
(81.76 KB)
📄
SECURITY
(7.5 KB)
📄
TRACEFLAGS
(3.1 KB)
📄
TUNING
(10.22 KB)
📄
alias.c
(22.22 KB)
📄
aliases
(1.43 KB)
📄
aliases.5
(3.15 KB)
📄
arpadate.c
(4.01 KB)
📄
bf.c
(17.58 KB)
📄
bf.h
(1007 B)
📄
collect.c
(24.45 KB)
📄
conf.c
(152.23 KB)
📄
conf.h
(7.13 KB)
📄
control.c
(8.91 KB)
📄
convtime.c
(3.56 KB)
📄
daemon.c
(99.13 KB)
📄
daemon.h
(1.46 KB)
📄
deliver.c
(151.7 KB)
📄
domain.c
(36.74 KB)
📄
envelope.c
(31.71 KB)
📄
err.c
(26.52 KB)
📄
headers.c
(50.32 KB)
📄
helpfile
(5.53 KB)
📄
macro.c
(14.86 KB)
📄
mailq.1
(3.46 KB)
📄
main.c
(108.07 KB)
📄
map.c
(177.38 KB)
📄
map.h
(3.81 KB)
📄
mci.c
(35.37 KB)
📄
milter.c
(103.43 KB)
📄
mime.c
(30.7 KB)
📄
newaliases.1
(1.27 KB)
📄
parseaddr.c
(80.3 KB)
📄
queue.c
(206.08 KB)
📄
ratectrl.c
(13.01 KB)
📄
ratectrl.h
(3.94 KB)
📄
readcf.c
(119.73 KB)
📄
recipient.c
(48.48 KB)
📄
sasl.c
(5.7 KB)
📄
savemail.c
(43.3 KB)
📄
sendmail.8
(17.31 KB)
📄
sendmail.h
(103.76 KB)
📄
sfsasl.c
(21.01 KB)
📄
sfsasl.h
(644 B)
📄
shmticklib.c
(1.51 KB)
📄
sm_resolve.c
(33.24 KB)
📄
sm_resolve.h
(5.25 KB)
📄
srvrsmtp.c
(133.04 KB)
📄
stab.c
(8.73 KB)
📄
stats.c
(4.17 KB)
📄
statusd_shm.h
(945 B)
📄
sysexits.c
(3.61 KB)
📄
timers.c
(4.29 KB)
📄
timers.h
(800 B)
📄
tls.c
(62.13 KB)
📄
tls.h
(8.1 KB)
📄
tlsh.c
(4.73 KB)
📄
trace.c
(4.25 KB)
📄
udb.c
(28.98 KB)
📄
usersmtp.c
(76.98 KB)
📄
util.c
(56.62 KB)
📄
version.c
(539 B)
Editing: sasl.c
/* * Copyright (c) 2001-2002 Proofpoint, Inc. and its suppliers. * All rights reserved. * * By using this file, you agree to the terms and conditions set * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * */ #include <sm/gen.h> SM_RCSID("@(#)$Id: sasl.c,v 8.24 2013-11-22 20:51:56 ca Exp $") #if SASL # include <stdlib.h> # include <sendmail.h> # include <errno.h> /* ** In order to ensure that storage leaks are tracked, and to prevent ** conflicts between the sm_heap package and sasl, we tell sasl to ** use the following heap allocation functions. Unfortunately, ** older sasl packages incorrectly specifies the size of a block ** using unsigned long: for portability, it should be size_t. */ # if defined(SASL_VERSION_FULL) && SASL_VERSION_FULL >= 0x02011a # define SM_SASL_SIZE_T size_t # else # define SM_SASL_SIZE_T unsigned long # endif void *sm_sasl_malloc __P((SM_SASL_SIZE_T)); static void *sm_sasl_calloc __P((SM_SASL_SIZE_T, SM_SASL_SIZE_T)); static void *sm_sasl_realloc __P((void *, SM_SASL_SIZE_T)); void sm_sasl_free __P((void *)); /* ** SASLv1: ** We can't use an rpool for Cyrus-SASL memory management routines, ** since the encryption/decryption routines in Cyrus-SASL ** allocate/deallocate a buffer each time. Since rpool ** don't release memory until the very end, memory consumption is ** proportional to the size of an e-mail, which is unacceptable. */ /* ** SM_SASL_MALLOC -- malloc() for SASL ** ** Parameters: ** size -- size of requested memory. ** ** Returns: ** pointer to memory. */ void * sm_sasl_malloc(size) SM_SASL_SIZE_T size; { return sm_malloc((size_t) size); } /* ** SM_SASL_CALLOC -- calloc() for SASL ** ** Parameters: ** nelem -- number of elements. ** elemsize -- size of each element. ** ** Returns: ** pointer to memory. ** ** Notice: ** this isn't currently used by SASL. */ static void * sm_sasl_calloc(nelem, elemsize) SM_SASL_SIZE_T nelem; SM_SASL_SIZE_T elemsize; { size_t size; void *p; size = (size_t) nelem * (size_t) elemsize; p = sm_malloc(size); if (p == NULL) return NULL; memset(p, '\0', size); return p; } /* ** SM_SASL_REALLOC -- realloc() for SASL ** ** Parameters: ** p -- pointer to old memory. ** size -- size of requested memory. ** ** Returns: ** pointer to new memory. */ static void * sm_sasl_realloc(o, size) void *o; SM_SASL_SIZE_T size; { return sm_realloc(o, (size_t) size); } /* ** SM_SASL_FREE -- free() for SASL ** ** Parameters: ** p -- pointer to free. ** ** Returns: ** none */ void sm_sasl_free(p) void *p; { sm_free(p); } /* ** SM_SASL_INIT -- sendmail specific SASL initialization ** ** Parameters: ** none. ** ** Returns: ** none ** ** Side Effects: ** installs memory management routines for SASL. */ void sm_sasl_init() { sasl_set_alloc(sm_sasl_malloc, sm_sasl_calloc, sm_sasl_realloc, sm_sasl_free); } /* ** INTERSECT -- create the intersection between two lists ** ** Parameters: ** s1, s2 -- lists of items (separated by single blanks). ** rpool -- resource pool from which result is allocated. ** ** Returns: ** the intersection of both lists. */ char * intersect(s1, s2, rpool) char *s1, *s2; SM_RPOOL_T *rpool; { char *hr, *h1, *h, *res; int l1, l2, rl; if (s1 == NULL || s2 == NULL) /* NULL string(s) -> NULL result */ return NULL; l1 = strlen(s1); l2 = strlen(s2); rl = SM_MIN(l1, l2); res = (char *) sm_rpool_malloc(rpool, rl + 1); if (res == NULL) return NULL; *res = '\0'; if (rl == 0) /* at least one string empty? */ return res; hr = res; h1 = s1; h = s1; /* walk through s1 */ while (h != NULL && *h1 != '\0') { /* is there something after the current word? */ if ((h = strchr(h1, ' ')) != NULL) *h = '\0'; l1 = strlen(h1); /* does the current word appear in s2 ? */ if (iteminlist(h1, s2, " ") != NULL) { /* add a blank if not first item */ if (hr != res) *hr++ = ' '; /* copy the item */ memcpy(hr, h1, l1); /* advance pointer in result list */ hr += l1; *hr = '\0'; } if (h != NULL) { /* there are more items */ *h = ' '; h1 = h + 1; } } return res; } # if SASL >= 20000 /* ** IPTOSTRING -- create string for SASL_IP*PORT property ** (borrowed from lib/iptostring.c in Cyrus-IMAP) ** ** Parameters: ** addr -- (pointer to) socket address ** addrlen -- length of socket address ** out -- output string (result) ** outlen -- maximum length of output string ** ** Returns: ** true iff successful. ** ** Side Effects: ** creates output string if successful. ** sets errno if unsuccessful. */ # include <arpa/inet.h> # ifndef NI_MAXHOST # define NI_MAXHOST 1025 # endif # ifndef NI_MAXSERV # define NI_MAXSERV 32 # endif bool iptostring(addr, addrlen, out, outlen) SOCKADDR *addr; SOCKADDR_LEN_T addrlen; char *out; unsigned outlen; { char hbuf[NI_MAXHOST], pbuf[NI_MAXSERV]; # if NETINET6 int niflags; # endif if (addr == NULL || out == NULL) { errno = EINVAL; return false; } # if NETINET6 niflags = (NI_NUMERICHOST | NI_NUMERICSERV); # ifdef NI_WITHSCOPEID if (addr->sa.sa_family == AF_INET6) niflags |= NI_WITHSCOPEID; # endif if (getnameinfo((struct sockaddr *) addr, addrlen, hbuf, sizeof(hbuf), pbuf, sizeof(pbuf), niflags) != 0) return false; # else /* NETINET6 */ if (addr->sa.sa_family != AF_INET) { errno = EINVAL; return false; } if (sm_strlcpy(hbuf, inet_ntoa(addr->sin.sin_addr), sizeof(hbuf)) >= sizeof(hbuf)) { errno = ENOMEM; return false; } sm_snprintf(pbuf, sizeof(pbuf), "%d", ntohs(addr->sin.sin_port)); # endif /* NETINET6 */ if (outlen < strlen(hbuf) + strlen(pbuf) + 2) { errno = ENOMEM; return false; } sm_snprintf(out, outlen, "%s;%s", hbuf, pbuf); return true; } # endif /* SASL >= 20000 */ #endif /* SASL */
Upload File
Create Folder