diff -urN sendmail-8.12.6/sendmail/map.c sendmail-8.12.6-nph-1.2-API/sendmail/map.c --- sendmail-8.12.6/sendmail/map.c Fri Aug 9 17:23:13 2002 +++ sendmail-8.12.6-nph-1.2-API/sendmail/map.c Sun Nov 24 13:59:41 2002 @@ -4888,11 +4888,25 @@ */ /* what version of the ph map code we're running */ -static char phmap_id[PH_BUF_SIZE]; +static char phmap_id[1024]; /* sendmail version for phmap id string */ extern const char Version[]; +/* assume we're using nph-1.1.x if not specified */ +# ifndef NPH_VERSION +# define NPH_VERSION 10100 +# endif + +/* compatibility for versions older than nph-1.2.0 */ +# if NPH_VERSION < 10200 +# define PH_OPEN_ROUNDROBIN PH_ROUNDROBIN +# define PH_OPEN_DONTID PH_DONTID +# define PH_CLOSE_FAST PH_FASTCLOSE +# define PH_ERR_DATAERR PH_DATAERR +# define PH_ERR_NOMATCH PH_NOMATCH +# endif /* NPH_VERSION < 10200 */ + /* ** PH_MAP_PARSEARGS -- parse ph map definition args. */ @@ -5090,7 +5104,12 @@ } static void +#if NPH_VERSION >= 10200 +ph_map_send_debug(appdata, text) + void *appdata; +#else ph_map_send_debug(text) +#endif char *text; { if (LogLevel > 9) @@ -5101,7 +5120,12 @@ } static void +#if NPH_VERSION >= 10200 +ph_map_recv_debug(appdata, text) + void *appdata; +#else ph_map_recv_debug(text) +#endif char *text; { if (LogLevel > 10) @@ -5178,9 +5202,14 @@ } /* open connection to server */ - if (!ph_open(&(pmap->ph), host, PH_ROUNDROBIN|PH_DONTID, - ph_map_send_debug, ph_map_recv_debug) && - !ph_id(pmap->ph, phmap_id)) + if (ph_open(&(pmap->ph), host, + PH_OPEN_ROUNDROBIN|PH_OPEN_DONTID, + ph_map_send_debug, ph_map_recv_debug +#if NPH_VERSION >= 10200 + , NULL +#endif + ) == 0 + && ph_id(pmap->ph, phmap_id) == 0) { if (ev != NULL) sm_clrevent(ev); @@ -5192,7 +5221,7 @@ save_errno = errno; if (ev != NULL) sm_clrevent(ev); - pmap->ph_fastclose = PH_FASTCLOSE; + pmap->ph_fastclose = PH_CLOSE_FAST; ph_map_close(map); errno = save_errno; } @@ -5253,7 +5282,7 @@ i = ph_email_resolve(pmap->ph, key, pmap->ph_field_list, &value); if (i == -1) *pstat = EX_TEMPFAIL; - else if (i == PH_NOMATCH || i == PH_DATAERR) + else if (i == PH_ERR_NOMATCH || i == PH_ERR_DATAERR) *pstat = EX_UNAVAILABLE; ph_map_lookup_abort: @@ -5268,7 +5297,7 @@ if (*pstat == EX_TEMPFAIL) { save_errno = errno; - pmap->ph_fastclose = PH_FASTCLOSE; + pmap->ph_fastclose = PH_CLOSE_FAST; ph_map_close(map); errno = save_errno; }