コード例 #1
0
ファイル: qmail-newu.c プロジェクト: 0xkag/qmail
void die_writet()
{
  substdio_putsflush(subfderr,"qmail-newu: fatal: unable to write users/cdb.tmp\n");
  die_temp();
}
コード例 #2
0
ファイル: qmail-newu.c プロジェクト: 0xkag/qmail
void die_rename()
{
  substdio_putsflush(subfderr,"qmail-newu: fatal: unable to move users/cdb.tmp to users/cdb\n");
  die_temp();
}
コード例 #3
0
ファイル: qmail-newu.c プロジェクト: 0xkag/qmail
void die_format()
{
  substdio_putsflush(subfderr,"qmail-newu: fatal: bad format in users/assign\n");
  die_temp();
}
コード例 #4
0
ファイル: qmail-newu.c プロジェクト: 0xkag/qmail
void die_reada()
{
  substdio_putsflush(subfderr,"qmail-newu: fatal: unable to read users/assign\n");
  die_temp();
}
コード例 #5
0
ファイル: qmail-newu.c プロジェクト: 0xkag/qmail
void die_nomem()
{
  substdio_putsflush(subfderr,"qmail-newu: fatal: out of memory\n");
  die_temp();
}
コード例 #6
0
ファイル: qmail-newu.c プロジェクト: 0xkag/qmail
void die_chdir()
{
  substdio_putsflush(subfderr,"qmail-newu: fatal: unable to chdir\n");
  die_temp();
}
コード例 #7
0
ファイル: qmail-verify.c プロジェクト: ajtulloch/qmail
int
lookup(stralloc *mail)
{
	const char *attrs[] = {  LDAP_ISACTIVE, 0 };
	char *f;
	int done;
	int status;
	int rv;

	if (q == 0) {
		q = qldap_new();
		if (q == 0)
			die_nomem();

		rv = qldap_open(q);
		if (rv != OK) die_temp();
		rv = qldap_bind(q, 0, 0);
		if (rv != OK) die_temp();
	}
	
	/*
	 * this handles the "catch all" and "-default" extension 
	 * but also the normal eMail address.
	 * Code handels also mail addresses with multiple '@' safely.
	 * at = index to last @ sign in mail address
	 * escaped = ldap escaped mailaddress
	 * len = length of escaped mailaddress
	 * i = position of current '-' or '@'
	 */
	done = 0;
	do {
		f = filter_mail(mail->s, &done);
		if (f == (char *)0) die_nomem();

		logit(16, "ldapfilter: '%s'\n", f);

		/* do the search for the email address */
		rv = qldap_lookup(q, f, attrs);
		switch (rv) {
		case OK:
			break; /* something found */
		case TIMEOUT:
			/* temporary error but give up so that the
			 * ldap server can recover */
			die_timeout();
		case TOOMANY:
#ifdef DUPEALIAS
			if (substdio_putflush(subfdout, "K", 1) == -1)
				die_write();
			qldap_free_results(q);
#else
			/* admin error, also temporary */
			temp_fail();
#endif
			return (-1);
		case FAILED:
			/* ... again temporary */
			temp_fail();
			return (-1);
		case NOSUCH:
			break;
		}
	} while (rv != OK && !done);
	/* reset filter_mail */
	filter_mail(0, 0);

	/* nothing found, try a local lookup or a alias delivery */
	if (rv == NOSUCH) {
		qldap_free_results(q);
		return (0);
	}

	/* check if the ldap entry is active */
	rv = qldap_get_status(q, &status);
	if (rv != OK) {
		temp_fail();
		return (-1);
	}
	if (status == STATUS_BOUNCE) {
		/* Mailaddress is administratively disabled. (#5.2.1) */
		if (substdio_puts(subfdout,
			    "DMailaddress is administratively disabled. "
			    "(#5.2.1)") == -1)
			die_write();
		if (substdio_putflush(subfdout, "", 1) == -1)
			die_write();
		qldap_free_results(q);
		return (1);
	} else if (status == STATUS_DELETE) {
		/* Sorry, no mailbox here by that name. (#5.1.1) */
		if (substdio_puts(subfdout,
			    "DSorry, no mailbox here by that name. "
			    "(#5.1.1)") == -1)
			die_write();
		if (substdio_putflush(subfdout, "", 1) == -1)
			die_write();
		qldap_free_results(q);
		return (1);
	}

	/* OK */
	if (substdio_putflush(subfdout, "K", 1) == -1)
		die_write();
	qldap_free_results(q);
	return (1);
}