summaryrefslogtreecommitdiffstats
path: root/usr.sbin/smtpd/makemap.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* makemap does not need a common which it does not use.deraadt2021-01-271-2/+1
|
* Fix two security vulnerabilities discovered by Qualys.millert2020-02-241-4/+9
| | | | | | | An out of bounds read in smtpd allows an attacker to inject arbitrary commands into the envelope file which are then executed as root. Separately, missing privilege revocation in smtpctl allows arbitrary commands to be run with the _smtpq group.
* remove the tag workaround for table_create() and table_find(),eric2018-12-281-2/+2
| | | | | | now that static tables handle their updates internally. ok gilles@
* unbreak newaliases.mortimer2018-07-031-9/+5
| | | | ok millert@
* rework the table API so that it takes a struct smtpd * context in parametergilles2018-06-161-2/+2
| | | | | | | | | of functions creating, looking up or destroying tables. this is a first step in cleaning up parse.y so it doesn't have side effects outside of parse_config(), bringing nothing but making code cleaner. ok millert@
* remove 'where' parameter from all x*() functions in utils.c, it doesn'tgilles2018-05-311-4/+4
| | | | | | really help us with anything, propagate the change in codebase ok millert@
* sync log.h with other daemonseric2018-04-261-1/+2
| | | | ok gilles@
* smtpctl(8): Use an int to determine mode instead of __progname.sunil2017-07-271-12/+7
| | | | Ok millert@ gilles@
* smtpd joins the 7 other daemons that share the same log.c file.reyk2017-01-091-2/+2
| | | | | | | | | The only major difference was the "log_trace" concept that is only used by smtpd - move it from log.c into util.c and make it a local concept. This also needed to rename the global "verbose" variable to "tracing" in a few places. OK krw@ gilles@ eric@
* Last parameter to execl[e]() functions *must* be cast to a pointer.krw2016-03-171-2/+2
| | | | | | | | | | | | Just NULL is not good practise as NULL is theoretically allowed to be an integer rather than a pointer. Use (char *)NULL consistently instead of scattering a few (char *)0 and (void *)NULL into the mix. Prompted by and probably ok deraadt@ millert@ kettenis@ Definitely ok mestre@ ratchov@
* remove support for 'dbm' which is really 'recno' from our makemap, it can'tgilles2016-02-131-3/+1
| | | | | | | | | | work because it requires dbopen() to be the call that creates the db, while we want mkstemp() to create an empty db ourselves. it has never worked, no one could ever create a recno db with our makemap & no one actually noticed so drop it. ok millert@, sunil@, jung@
* Cleanup getopt(3) mis-use in sendmail compat code.sunil2016-02-121-5/+19
| | | | | | | | | | | Avoid multiple getopt(3) evaluations without optreset set and unspecified behavior of optind = 0 as per POSIX. Instead, iterate over argv the first time for classification. Fixes -portable without any divergence from -current, and all newaliases opts are handled in one place. Looks good to me millert@ Ok gilles@ jung@ eric@
* when creating a db map, we use a temporary file to work on and atomicallygilles2016-02-101-2/+2
| | | | | | | | | | move to destination when done. this causes dbopen() to be called with an empty file which happens to... not work with other db libraries. adding O_TRUNC is noop for us, fixes the issue for other libraries and lets us reduce delta between us and portable. ok sunil@, ok eric@
* remove spaces after '!'jung2015-12-281-8/+8
| | | | | | no binary change ok millert
* Sync the DB file once when done with fsync(), not on each write with O_SYNC.guenther2015-12-151-3/+18
| | | | | | The DB file being written is a temp file, so O_EXLOCK is unnecesary. ok sunil@ gilles@
* Move some variables local to makemap().sunil2015-12-131-27/+24
| | | | Suggested by guenther@ Ok gilles@
* Add -U option like the sendmail makemap, for dumping DB files back to textguenther2015-12-111-3/+42
| | | | ok sunil@ gilles@
* Merge makemap(8) into smtpctl(8).sunil2015-12-071-20/+19
| | | | Ok gilles@, jung@
* Fix makemap(8) for values containing a '#'.sunil2015-10-261-6/+6
| | | | Ok millert@ gilles@
* makemap shout strip initial and trailing whitespaces using strip()gilles2015-10-171-10/+3
| | | | ok millert@, ok jung@
* do not umask() [with the wrong umask] around mkstemp() calls, no matterderaadt2015-10-121-4/+1
| | | | | how broken other systems are. ok guenther gilles
* fix values passed to umask(), they should be octal.gilles2015-10-061-2/+2
| | | | | | the permissions are even more restrictive than they should. misc bug reported by qualys
* use <limits.h> comprehensively. For now try to push <> includes toderaadt2015-01-201-2/+2
| | | | | | 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.
* Replace <sys/param.h> with <limits.h> and other less dirty headers wherederaadt2015-01-161-1/+2
| | | | | | | | | 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)
* newaliases / makemap should parse multi-line aliases entriesgilles2014-10-251-2/+2
|
* Update the table API: lookup functions can take an optional parameterseric2014-07-081-1/+7
| | | | | | | dictionnary (currently not set). While there, add a helper for forking external backends, and remove unused table functions. ok gilles@
* bcopy -> memmoveeric2013-12-261-2/+2
| | | | bzero -> memset
* unsigned char casts for ctypeeric2013-11-281-6/+6
| | | | ok gilles@
* sort includeseric2013-10-291-2/+2
|
* sync with OpenSMTPD 5.3.2eric2013-05-241-28/+29
| | | | ok gilles@
* Prevent race conditions in db file handling.tobias2013-03-291-26/+24
| | | | ok gilles
* assorted fixes spotted by Coverity.eric2013-01-311-4/+5
| | | | | | some log message updates. ok gilles@
* Sync with our smtpd repo:gilles2013-01-261-17/+9
| | | | | | | | | | | | | | | | | | | | | | * 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@
* knferic2012-11-231-11/+15
| | | | ok gilles@
* when makemap is executed in sendmail mode, check if ".db" is part of thegilles2012-10-131-2/+14
| | | | | | filename and imply it otherwise so that the following works: makemap hash /etc/mail/aliases < aliases
* when building a db map, always lowercase the key before a lookup in makemapgilles2012-10-081-5/+7
| | | | | | | | smtpd already does it, but this allows spotting a cycle at makemap time, so user isn't surprised at runtime. while at it, be more tolerant when user specifies /etc/mail/aliases instead of /etc/mail/aliases.db
* We need to provide a sendmail-like interface to makemap so that some toolsgilles2012-10-071-13/+39
| | | | | | | | that assume sendmail do not break ... add support for reading map source from stdin, for specifying the DBTYPE of a map, and teach OUR makemap to emulate sendmail interface. ok eric@
* use xstrdup() helperchl2012-09-271-11/+4
| | | | ok eric@ gilles@
* expandnodes must be bzero()'d before parsing to be sure there is no boguseric2012-09-191-2/+1
| | | | | | | data left on return, since the RB compare functions uses memcmp(). While there, remove all calls to bzero() before alias_parse(). ok gilles@
* rename variables for consistencyeric2012-09-191-4/+4
| | | | ok gilles@
* coding style: replace all occurences of u_int* with uint*chl2012-08-191-3/+3
| | | | ok eric@
* - introduce xlowercase() and allow lowercase() to fail gracefullygilles2012-07-291-2/+2
| | | | | | | | | | | | | | | - replace all calls to lowercase() with calls to xlowercase() - in the format string expansion, lowercase() all formats we will have to reassess all calls to xlowercase() even though it has never triggered as far as I know, we can probably gracefully fail some of them. right now we're just keeping former behaviour. this commit fixes issue reported by Hugo Osvaldo Barrera where a %u format could lead to a delivery failure (ie: GILLES@openbsd.org should be expanded to gilles, not GILLES ... only for local deliveries). ok chl@ on the idea, ok eric@ on the diff
* plug leak in make_aliases()jasper2011-05-161-2/+2
| | | | with/ok gilles@
* fix segfault in newaliases after global env move.eric2011-05-091-3/+2
| | | | | spotted by Christopher Zimmermann ok gilles@
* the smtpd env is meant to be global, so do not pass it all around.eric2011-05-011-6/+11
| | | | discussed with and ok gilles@
* cleanups, cosmethic changes, functions that should be static are now staticgilles2011-04-171-9/+8
| | | | no functionnal change
* remove all unused headersgilles2010-11-281-3/+3
|
* a bit of .h cleanups, no functionnal changegilles2010-11-281-1/+3
|
* initial work at fixing aliases support:gilles2010-04-271-27/+11
| | | | | | | | | | | | | | - kill struct alias, struct expandnode is used instead - introduce map_parse_alias() and map_parse_virtual() - aliases and virtual code no longer assume db(3) but use the map API which lets them become backend agnostic AND value-checked. this actually makes the code simpler by removing all values parsing from aliases.c - rename K_SECRETS -> K_SECRET, K_ALIASES -> K_ALIAS for consistency the enum has singular names. - aliases, virtual and forward now work with an expandtree and deal with multiple levels of resolving by merging expandtree's more coming soon ;)
* when creating a map, make sure we do not store a key/val separator at thegilles2010-04-211-1/+5
| | | | | beginning of the key (ie: "gilles: bleh" should not be stored as key[gilles] val[ bleh])