qmail-smtpd-chkusr 0.2 patch
This version of chkusr has been substituted by chkuser 2.0, that you find at this page.
qmail-smtpd-chkusr V. 0.2
This version includes additional control on BOUNCE_MAIL flag > /* General control: check the existence of a real user */ > > user_passwd = vauth_getpw (user.s, domain.s); > > if (user_passwd != NULL) { > > /* If user exists check if he has BOUNCE_MAIL flag set */ > > if (user_passwd->pw_gid BOUNCE_MAIL) > retstat = 0; > else > retstat = 1; > } > else { > Checking alias existence throught .qmail-alias files > /* My control: check for alias only if a domain (default or not) is specified */ > /* Change all '.' in ':' before continuing on aliases */ > > if (!stralloc_copys ( user.s)) die_nomem(); > if (!stralloc_0 ( die_nomem(); > > for (count = 0; *(alias_name.s + count) != 0; ++count) > if (*(alias_name.s + count) == '.') *(alias_name.s + count) = ':'; > > /* Check if alias file exists */ > > if (!stralloc_copys ( VPOPMAILDIR)) die_nomem(); > if (!stralloc_cats ( "/domains/")) die_nomem(); > if (!stralloc_cats ( domain.s)) die_nomem(); > if (!stralloc_cats ( "/.qmail-")) die_nomem(); > if (!stralloc_cats ( alias_name.s)) die_nomem(); > if (!stralloc_0 ( die_nomem(); > > fd_file = open_read (alias_path.s); > if (fd_file != -1) { > close (fd_file); > retstat = 1; > } > else { Checking for mailing list, controlling if the recipient name starts with a valid mailing list name > /* Let's check for mailing lists */ > > /* Set up the search string for mailing-list path */ > if (!stralloc_copys ( VPOPMAILDIR)) die_nomem(); > if (!stralloc_cats ( "/domains/")) die_nomem(); > if (!stralloc_cats ( domain.s)) die_nomem(); > if (!stralloc_cats ( "/")) die_nomem(); > if (!stralloc_cats ( user.s)) die_nomem(); > if (!stralloc_0 ( die_nomem(); > > /* Search for the outer '-' character */ > > for (offset = user.len - 1; offset > 0; --offset) > if (*(user.s + offset) == '-') { > *(alias_path.s + alias_path.len - user.len + offset) = 0; > *(mailing_path.s + mailing_path.len - user.len + offset) = 0; > fd_file = open_read (alias_path.s); > if (fd_file != -1) { > close (fd_file); > dir_file = opendir (mailing_path.s); > if (dir_file != NULL) { > closedir (dir_file); > retstat = 1; > break; > } > } > } > } > } > Resume original UID and GID > /* Set back the effective UID and GID (smtp) */ > > setegid (eff_gid); > seteuid (eff_uid); > Exits the routine returning the result > return retstat; > } > Calling the new checking user routine, within the existing addrallowed function. int addrallowed() { ......................... ......................... else if (!addrallowed()) { err_nogateway(); return; } + if (!realrcpt_check()) { err_realrcpt(); return; } if (!stralloc_cats( die_nomem(); if (!stralloc_cats( die_nomem(); if (!stralloc_0( die_nomem();
Document info
Page created on 5 march 2002, last modified on 5 march 2002.