diff options
| author | Gregory Neil Shapiro <gshapiro@FreeBSD.org> | 2023-01-15 19:15:36 +0000 |
|---|---|---|
| committer | Gregory Neil Shapiro <gshapiro@FreeBSD.org> | 2023-01-15 19:15:36 +0000 |
| commit | 28fbd2825d216dafca4d991ad96d05b312f4f9a3 (patch) | |
| tree | 8b322391c58a9bd5ad56827bbb8fcf4cbd114917 /makemap | |
| parent | 0694dcb04b81dfbd70ffe7384816863170a48b3e (diff) | |
Import sendmail 8.17.1vendor/sendmail/8.17.1
Diffstat (limited to 'makemap')
| -rw-r--r-- | makemap/makemap.0 | 93 | ||||
| -rw-r--r-- | makemap/makemap.c | 69 |
2 files changed, 110 insertions, 52 deletions
diff --git a/makemap/makemap.0 b/makemap/makemap.0 index 61f4d6f868dc..202c235c168b 100644 --- a/makemap/makemap.0 +++ b/makemap/makemap.0 @@ -1,101 +1,100 @@ -MAKEMAP(8) MAKEMAP(8) +MAKEMAP(8) System Manager's Manual MAKEMAP(8) -[1mNAME[0m +NNAAMMEE makemap - create database maps for sendmail -[1mSYNOPSIS[0m - [1mmakemap [22m[[1m-C [4m[22mfile[24m] [[1m-N[22m] [[1m-c [4m[22mcachesize[24m] [[1m-d[22m] [[1m-D [4m[22mcommentchar[24m] [[1m-e[22m] [[1m-f[22m] - [[1m-l[22m] [[1m-o[22m] [[1m-r[22m] [[1m-s[22m] [[1m-t [4m[22mdelim[24m] [[1m-u[22m] [[1m-v[22m] [4mmaptype[24m [4mmapnam[0m +SSYYNNOOPPSSIISS + mmaakkeemmaapp [--CC _f_i_l_e] [--NN] [--cc _c_a_c_h_e_s_i_z_e] [--dd] [--DD _c_o_m_m_e_n_t_c_h_a_r] [--ee] [--ff] + [--ll] [--oo] [--rr] [--ss] [--tt _d_e_l_i_m] [--uu] [--vv] _m_a_p_t_y_p_e _m_a_p_n_a_m -[1mDESCRIPTION[0m - [1mMakemap [22mcreates the database maps used by the keyed map lookups in +DDEESSCCRRIIPPTTIIOONN + MMaakkeemmaapp creates the database maps used by the keyed map lookups in sendmail(8). It reads input from the standard input and outputs them - to the indicated [4mmapname.[0m + to the indicated _m_a_p_n_a_m_e_. - Depending on how it is compiled, [1mmakemap [22mhandles different database - formats, selected using the [4mmaptype[24m parameter. They may be + Depending on how it is compiled, mmaakkeemmaapp handles different database + formats, selected using the _m_a_p_t_y_p_e parameter. They may be dbm DBM format maps. This requires the ndbm(3) library. - btree B-Tree format maps. This requires the new Berkeley DB library. + btree B-Tree format maps. This requires the new Berkeley DB library. hash Hash format maps. This also requires the Berkeley DB library. - cdb CDB (Constant DataBase) format maps. This requires the tinycdb + cdb CDB (Constant DataBase) format maps. This requires the tinycdb library. implicit - The first available format in the following order: hash, dbm, + The first available format in the following order: hash, dbm, and cdb. - In all cases, [1mmakemap [22mreads lines from the standard input consisting of + In all cases, mmaakkeemmaapp reads lines from the standard input consisting of two words separated by white space. The first is the database key, the - second is the value. The value may contain ``%[4mn[24m'' strings to indicate - parameter substitution. Literal percents should be doubled (``%%''). + second is the value. The value may contain ``%_n'' strings to indicate + parameter substitution. Literal percents should be doubled (``%%''). Blank lines and lines beginning with ``#'' are ignored. - Notice: do [1mnot [22muse [1mmakemap [22mto create the aliases data base, but - [1mnewaliases [22mwhich puts a special token into the data base that is - required by [1msendmail.[0m + Notice: do nnoott use mmaakkeemmaapp to create the aliases data base, but + nneewwaalliiaasseess which puts a special token into the data base that is re- + quired by sseennddmmaaiill.. - If the [4mTrustedUser[24m option is set in the sendmail configuration file and - [1mmakemap [22mis invoked as root, the generated files will be owned by the - specified [4mTrustedUser.[0m + If the _T_r_u_s_t_e_d_U_s_e_r option is set in the sendmail configuration file and + mmaakkeemmaapp is invoked as root, the generated files will be owned by the + specified _T_r_u_s_t_e_d_U_s_e_r_. - [1mFlags[0m - [1m-C [22mUse the specified [1msendmail [22mconfiguration file for looking up the + FFllaaggss + --CC Use the specified sseennddmmaaiill configuration file for looking up the TrustedUser option. - [1m-N [22mInclude the null byte that terminates strings in the map. This + --NN Include the null byte that terminates strings in the map. This must match the -N flag in the sendmail.cf ``K'' line. - [1m-c [22mUse the specified hash and B-Tree cache size. + --cc Use the specified hash and B-Tree cache size. - [1m-D [22mUse to specify the character to use to indicate a comment (which + --DD Use to specify the character to use to indicate a comment (which is ignored) instead of the default of '#'. - [1m-d [22mAllow duplicate keys in the map. This is only allowed on B-Tree - format maps. If two identical keys are read, they will both be + --dd Allow duplicate keys in the map. This is only allowed on B-Tree + format maps. If two identical keys are read, they will both be inserted into the map. - [1m-e [22mAllow empty value (right hand side). + --ee Allow empty value (right hand side). - [1m-f [22mNormally all upper case letters in the key are folded to lower - case. This flag disables that behaviour. This is intended to - mesh with the -f flag in the [1mK [22mline in sendmail.cf. The value + --ff Normally all upper case letters in the key are folded to lower + case. This flag disables that behaviour. This is intended to + mesh with the -f flag in the KK line in sendmail.cf. The value is never case folded. - [1m-l [22mList supported map types. + --ll List supported map types. - [1m-o [22mAppend to an old file. This allows you to augment an existing - file. Note: this might not be supported by all database types, + --oo Append to an old file. This allows you to augment an existing + file. Note: this might not be supported by all database types, e.g., cdb. - [1m-r [22mAllow replacement of existing keys. Normally [1mmakemap [22mcomplains + --rr Allow replacement of existing keys. Normally mmaakkeemmaapp complains if you repeat a key, and does not do the insert. - [1m-s [22mIgnore safety checks on maps being created. This includes - checking for hard or symbolic links in world writable directo- + --ss Ignore safety checks on maps being created. This includes + checking for hard or symbolic links in world writable directo- ries. - [1m-t [22mUse the specified delimiter instead of white space (also for + --tt Use the specified delimiter instead of white space (also for dumping a map). - [1m-u [22mdump (unmap) the content of the database to standard output. + --uu dump (unmap) the content of the database to standard output. - [1m-v [22mVerbosely print what it is doing. + --vv Verbosely print what it is doing. - -[1mExample[0m +EExxaammppllee makemap hash /etc/mail/access < /etc/mail/access -[1mSEE ALSO[0m +SSEEEE AALLSSOO sendmail(8), newaliases(1) -[1mHISTORY[0m - The [1mmakemap [22mcommand appeared in 4.4BSD. +HHIISSTTOORRYY + The mmaakkeemmaapp command appeared in 4.4BSD. diff --git a/makemap/makemap.c b/makemap/makemap.c index 4aa8d6ddab38..f2ed0e39f990 100644 --- a/makemap/makemap.c +++ b/makemap/makemap.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998-2002, 2004, 2008 Proofpoint, Inc. and its suppliers. + * Copyright (c) 1998-2002, 2004, 2008, 2020 Proofpoint, Inc. and its suppliers. * All rights reserved. * Copyright (c) 1992 Eric P. Allman. All rights reserved. * Copyright (c) 1992, 1993 @@ -38,6 +38,9 @@ SM_IDSTR(id, "@(#)$Id: makemap.c,v 8.183 2013-11-22 20:51:52 ca Exp $") #include <sm/path.h> #include <sendmail/pathnames.h> #include <libsmdb/smdb.h> +#if USE_EAI +# include <sm/ixlen.h> +#endif uid_t RealUid; gid_t RealGid; @@ -67,6 +70,11 @@ usage(progname) sm_io_fprintf(smioerr, SM_TIME_DEFAULT, " %*s [-d] [-e] [-f] [-l] [-o] [-r] [-s] [-t delimiter]\n", (int) strlen(progname), ""); +#if _FFR_TESTS + sm_io_fprintf(smioerr, SM_TIME_DEFAULT, + " %*s [-S n]\n", + (int) strlen(progname), ""); +#endif sm_io_fprintf(smioerr, SM_TIME_DEFAULT, " %*s [-u] [-v] type mapname\n", (int) strlen(progname), ""); @@ -286,6 +294,12 @@ main(argc, argv) static char rnamebuf[MAXNAME]; /* holds RealUserName */ extern char *optarg; extern int optind; +#if USE_EAI + bool ascii = true; +#endif +#if _FFR_TESTS + int slp = 0; +#endif memset(¶ms, '\0', sizeof params); params.smdbp_cache_size = 1024 * 1024; @@ -313,7 +327,12 @@ main(argc, argv) SMDB_MAX_USER_NAME_LEN); #define OPTIONS "C:D:Nc:defi:Llorst:uvx" - while ((opt = getopt(argc, argv, OPTIONS)) != -1) +#if _FFR_TESTS +# define X_OPTIONS "S:" +#else +# define X_OPTIONS +#endif + while ((opt = getopt(argc, argv, OPTIONS X_OPTIONS)) != -1) { switch (opt) { @@ -369,6 +388,12 @@ main(argc, argv) allowreplace = true; break; +#if _FFR_TESTS + case 'S': + slp = atoi(optarg); + break; +#endif + case 's': setbitn(DBS_MAPINUNSAFEDIRPATH, DontBlameSendmail); setbitn(DBS_WRITEMAPTOHARDLINK, DontBlameSendmail); @@ -393,7 +418,7 @@ main(argc, argv) case 'v': verbose = true; break; - + case 'x': smdb_print_available_types(true); exit(EX_OK); @@ -602,12 +627,41 @@ main(argc, argv) memset(&db_val, '\0', sizeof db_val); db_key.data = ibuf; - for (p = ibuf; *p != '\0' && !(ISSEP(*p)); p++) +#if USE_EAI + db_key.size = 0; + if (foldcase) + { + for (p = ibuf; *p != '\0' && !ISSEP(*p); p++) + { + if (!ISASCII(*p)) + ascii = false; + } + if (!ascii) + { + char sep; + char *lkey; + + sep = *p; + *p = '\0'; + + lkey = sm_lowercase(ibuf); + db_key.data = lkey; + db_key.size = strlen(lkey); + *p = sep; + } + } + if (ascii) +#endif /* USE_EAI */ + /* NOTE: see if () above! */ + for (p = ibuf; *p != '\0' && !ISSEP(*p); p++) { if (foldcase && ISASCII(*p) && isupper(*p)) *p = tolower(*p); } - db_key.size = p - ibuf; +#if USE_EAI + if (0 == db_key.size) +#endif + db_key.size = p - ibuf; if (inclnull) db_key.size++; @@ -680,6 +734,11 @@ main(argc, argv) } } +#if _FFR_TESTS + if (slp > 0) + sleep(slp); +#endif + /* ** Now close the database. */ |
