summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/util.c
AgeCommit message (Collapse)Author
2016-05-16replace hardcoded + with TAG_CHARGilles Chehade
2016-03-25Nuke session_socket_blockmode() and session_socket_linger(). UseKenneth R Westerback
the identical io_set_blocking() and io_set_linger(). Since both are always called to turn off blocking or lingering, nuke the parameter and associated enum in favour of "just doing the right thing". While passing remove the unneeded last parameter to the remaining fcntl(F_GETFL). Finally, rename the functions to io_set_nonblocking() and io_set_nolinger() for clarity. No functional change. Started with a sweep of fcntl() usage inspired by guenther@. ok gilles@
2016-01-12Let smtpd start on machines without a FQDN as hostname.Sunil Nimmagadda
Ok millert@ gilles@ jung@
2015-12-28remove spaces after '!'Joerg Jung
no binary change ok millert
2015-12-14remove trailing whitespaceJoerg Jung
ok sunil gilles
2015-10-17mailaddr_match() allows comparing two struct mailaddr taking into accountGilles Chehade
catchall and +-tags ok millert@ and jung@ for util.c
2015-10-17our strip() function should use isspace()Gilles Chehade
ok jung@, ok millert@
2015-10-12do not umask() [with the wrong umask] around mkstemp() calls, no matterTheo de Raadt
how broken other systems are. ok guenther gilles
2015-10-10three conversions of fgetln() to getline()Joerg Jung
ok eric sunil
2015-10-06fix values passed to umask(), they should be octal.Gilles Chehade
the permissions are even more restrictive than they should. misc bug reported by qualys
2015-10-06fix reallocarray() constructs to always use temporary variableGilles Chehade
2015-10-05actually use lbuf in getmailname()Stefan Sperling
ok millert@ gilles@
2015-10-02in secure_file(), make uid checking on .forward files more strict to avoidGilles Chehade
users creating hardlink to root-owned files and leaking first line. reported by Qualys Security
2015-08-16when we switch valid_domainpart() from our own logic to using res_hnok() weGilles Chehade
missed the fact that res_hnok() will consider an empty string as valid.
2015-05-06use res_hnok() to valid domain part in valid_domain()Gilles Chehade
ok eric@
2015-01-20use <limits.h> comprehensively. For now try to push <> includes toTheo de Raadt
each .c file, and out of the .h files. To avoid overinclude. ok gilles, in principle. If this has been done right, -portable should become easier to maintain.
2015-01-16Replace <sys/param.h> with <limits.h> and other less dirty headers whereTheo de Raadt
possible. Annotate <sys/param.h> lines with their current reasons. Switch to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where sensible to avoid pulling in the pollution. These are the files confirmed through binary verification. ok guenther, millert, doug (helped with the verification protocol)
2014-05-25use reallocarray.Marc Espie
okay gilles@
2014-04-19(void) cast a strlcpy that cannot truncateGilles Chehade
2014-02-04extend allowed charset for email address, escape all potentially dangerous ones.Eric Faurot
2014-02-04add base64_encode/base64_decode helpersEric Faurot
2014-02-04get rid of fdlimit()Eric Faurot
2014-01-08ctype cleanup; ok gillesTheo de Raadt
2013-12-26bcopy -> memmoveEric Faurot
bzero -> memset
2013-11-28unsigned char casts for ctypeEric Faurot
ok gilles@
2013-11-19Allow '*' in the user part of mailaddresses. By default, potentially dangerousEric Faurot
characters are replaced when expanding for local deliveries, unless the "raw" modifier is specified.
2013-10-29use "/etc/mail/mailname" instead of "/etc/mailname" and make it a define.Eric Faurot
2013-10-29randomize counter part of generated uidsEric Faurot
2013-10-27use log_* functions instead of err*/warn*Eric Faurot
2013-10-25local enqueuer improvements:Eric Faurot
- parse the whole input before trying to establish the connection to the local socket: fixes timeout problems when reading the output of a long running program. - use sendmail(8)-like exit status.
2013-07-19add '!' in email addresses supported charsetEric Faurot
2013-07-19Introduce expand string modifiersEric Faurot
2013-07-19get rid of sa_set_port() and its awfully contorted implementationEric Faurot
2013-05-24sync with OpenSMTPD 5.3.2Eric Faurot
ok gilles@
2013-04-12replace MAX_LINE_SIZE and SMTP_LINE_MAX with SMTPD_MAXLINESIZE forEric Faurot
consistency and clarity. Remove useless and confusing extra byte in a few arrays based on this define. ok gilles@
2013-02-05- handle getaddrinfo() error as LKA_TEMPFAILGilles Chehade
- handle getsockname() error in smtp_connected() - accept '/' as part of user-part, expand to ':' as done by qmail - fix wrong check in mda leading to bogus Return-Path header - fix aliases parsing when there's a white space between key and separator - some cosmethic cleanup
2013-01-31assorted fixes spotted by Coverity.Eric Faurot
some log message updates. ok gilles@
2013-01-26Sync with our smtpd repo:Gilles Chehade
* first bricks of ldap and sqlite support (not finished but both working) * new table API to replace map API, all lookups are done through tables * improved handling of temporary errors throughout the daemon * improved scheduler and mta logic: connection reuse, optimizes batches * improved queue: more tolerant to admin errors, new layout, less disk-IO * improved memory usage under high load * SSL certs/keys isolated to lookup process to avoid facing network * VIRTUAL support improved, fully virtual setups possible now * runtime tracing of processes through smtpctl trace * ssl_privsep.c sync-ed with relayd * ssl.c no longer contains smtpd specific interfaces * smtpd-specific ssl bits moved to ssl_smtpd.c * update mail address in copyright FLUSH YOUR QUEUE. FLUSH YOUR QUEUE. FLUSH YOUR QUEUE. FLUSH YOUR QUEUE. smtpd.conf(5) simplified, it will require adaptations ok eric@
2012-11-23knfEric Faurot
ok gilles@
2012-11-12Cleanups and improvements:Eric Faurot
* Log more events (especially client session) and use a better scheme for that: each messages is prefixed with a token to easily identify its class: - info/warn/debug: general server messages - smtp-in: smtp client connections - relay: status update for relayed messages - delivery: status update for local deliveries * Implement "smtpctl monitor" to display updates of selected internal counters. * When reloading the on-disk queue at startup do not commit a message if no envelope was submitted for that message. * Remove unused stuff in the config parser. ok gilles@
2012-10-10teach smtpctl how to display envelopes and messages using their id.Gilles Chehade
this allows an admin to inspect the queue without having to manually extract bucket and find the path to an envelope or message. diff by Sunil Nimmagadda <sunil@poolp.org> ok eric@, chl@ and I
2012-10-07convert iobuf_queue()'s to iobuf_fqueue(). (idea from gilles@)Charles Longeau
introduce iobuf_xinit() and iobuf_xfqueue(). (idea from eric@) ok gilles@
2012-10-04change to from=<...>, to=<...> instead of to=<...> for loggingTodd T. Fries
from gilles@ ok eric@
2012-09-26Stop using the delivery_data union (field "to") in delivery_mda.Eric Faurot
It's confusing and not necessary as it's only used for "buffer". Instead, just add a "buffer" member in the structure and rename "as_user" to "user". The delivery_data union becomes an anonymous union in expandnode, which is the only other place where it's used. ok gilles@
2012-09-26log final user and method used for local deliveries.Eric Faurot
ok gilles@
2012-09-25need inttypes.hEric Faurot
from millert@
2012-09-21Add a log_envelope() function that log envelope status in a uniform way.Eric Faurot
It automagically adds an rcpt=<user@domain> field if "dest" differs from the original "rcpt". The function takes an "extra" parameter that allows to add some specific info depending on the context. ok gilles@
2012-09-21Move ruleset_match() prototype to smtpd.h and make the envelope const.Eric Faurot
Adapt a lot of functions in chain to use const args where required. ok gilles@
2012-09-20constify parameters that are supposed to be const.Eric Faurot
ok gilles@
2012-09-18- add xmemdup() helper.Eric Faurot
- remove useless block in switch. ok gilles@