summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/makemap.c
AgeCommit message (Collapse)Author
2021-06-14add required headers for smtpd.h and remove unnecessary ones in other files.Eric Faurot
ok jung@
2021-01-27makemap does not need a common which it does not use.Theo de Raadt
2020-02-24Fix two security vulnerabilities discovered by Qualys.Todd C. Miller
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.
2018-12-28remove the tag workaround for table_create() and table_find(),Eric Faurot
now that static tables handle their updates internally. ok gilles@
2018-07-03unbreak newaliases.mortimer
ok millert@
2018-06-16rework the table API so that it takes a struct smtpd * context in parameterGilles Chehade
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@
2018-05-31remove 'where' parameter from all x*() functions in utils.c, it doesn'tGilles Chehade
really help us with anything, propagate the change in codebase ok millert@
2018-04-26sync log.h with other daemonsEric Faurot
ok gilles@
2017-07-27smtpctl(8): Use an int to determine mode instead of __progname.Sunil Nimmagadda
Ok millert@ gilles@
2017-01-09smtpd joins the 7 other daemons that share the same log.c file.Reyk Floeter
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@
2016-03-17Last parameter to execl[e]() functions *must* be cast to a pointer.Kenneth R Westerback
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@
2016-02-13remove support for 'dbm' which is really 'recno' from our makemap, it can'tGilles Chehade
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@
2016-02-12Cleanup getopt(3) mis-use in sendmail compat code.Sunil Nimmagadda
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@
2016-02-10when creating a db map, we use a temporary file to work on and atomicallyGilles Chehade
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@
2015-12-28remove spaces after '!'Joerg Jung
no binary change ok millert
2015-12-15Sync the DB file once when done with fsync(), not on each write with O_SYNC.Philip Guenther
The DB file being written is a temp file, so O_EXLOCK is unnecesary. ok sunil@ gilles@
2015-12-13Move some variables local to makemap().Sunil Nimmagadda
Suggested by guenther@ Ok gilles@
2015-12-11Add -U option like the sendmail makemap, for dumping DB files back to textPhilip Guenther
ok sunil@ gilles@
2015-12-07Merge makemap(8) into smtpctl(8).Sunil Nimmagadda
Ok gilles@, jung@
2015-10-26Fix makemap(8) for values containing a '#'.Sunil Nimmagadda
Ok millert@ gilles@
2015-10-17makemap shout strip initial and trailing whitespaces using strip()Gilles Chehade
ok millert@, ok jung@
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-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-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-10-25newaliases / makemap should parse multi-line aliases entriesGilles Chehade
2014-07-08Update the table API: lookup functions can take an optional parametersEric Faurot
dictionnary (currently not set). While there, add a helper for forking external backends, and remove unused table functions. ok gilles@
2013-12-26bcopy -> memmoveEric Faurot
bzero -> memset
2013-11-28unsigned char casts for ctypeEric Faurot
ok gilles@
2013-10-29sort includesEric Faurot
2013-05-24sync with OpenSMTPD 5.3.2Eric Faurot
ok gilles@
2013-03-29Prevent race conditions in db file handling.Tobias Stoeckmann
ok gilles
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-10-13when makemap is executed in sendmail mode, check if ".db" is part of theGilles Chehade
filename and imply it otherwise so that the following works: makemap hash /etc/mail/aliases < aliases
2012-10-08when building a db map, always lowercase the key before a lookup in makemapGilles Chehade
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
2012-10-07We need to provide a sendmail-like interface to makemap so that some toolsGilles Chehade
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@
2012-09-27use xstrdup() helperCharles Longeau
ok eric@ gilles@
2012-09-19expandnodes must be bzero()'d before parsing to be sure there is no bogusEric Faurot
data left on return, since the RB compare functions uses memcmp(). While there, remove all calls to bzero() before alias_parse(). ok gilles@
2012-09-19rename variables for consistencyEric Faurot
ok gilles@
2012-08-19coding style: replace all occurences of u_int* with uint*Charles Longeau
ok eric@
2012-07-29- introduce xlowercase() and allow lowercase() to fail gracefullyGilles Chehade
- 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
2011-05-16plug leak in make_aliases()Jasper Lievisse Adriaanse
with/ok gilles@
2011-05-09fix segfault in newaliases after global env move.Eric Faurot
spotted by Christopher Zimmermann ok gilles@
2011-05-01the smtpd env is meant to be global, so do not pass it all around.Eric Faurot
discussed with and ok gilles@
2011-04-17cleanups, cosmethic changes, functions that should be static are now staticGilles Chehade
no functionnal change
2010-11-28remove all unused headersGilles Chehade
2010-11-28a bit of .h cleanups, no functionnal changeGilles Chehade
2010-04-27initial work at fixing aliases support:Gilles Chehade
- 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 ;)