DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T x

⟦76fc95844⟧ TextFile

    Length: 2389 (0x955)
    Types: TextFile
    Names: »x400_validate.c«

Derivation

└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0
    └─⟦dc59850a2⟧ »EurOpenD22/pp5.0/pp-5.tar.Z« 
        └─⟦e5a54fb17⟧ 
            └─⟦this⟧ »pp-5.0/Lib/parse/x400_validate.c« 

TextFile

/* x400_validate.c: validate an x400 address */

# ifndef lint
static char Rcsid[] = "@(#)$Header: /cs/research/pp/hubris/pp-beta/Lib/parse/RCS/x400_validate.c,v 5.0 90/09/20 16:10:06 pp Exp Locker: pp $";
# endif

/*
 * $Header: /cs/research/pp/hubris/pp-beta/Lib/parse/RCS/x400_validate.c,v 5.0 90/09/20 16:10:06 pp Exp Locker: pp $
 *
 * $Log:	x400_validate.c,v $
 * Revision 5.0  90/09/20  16:10:06  pp
 * rcsforce : 5.0 public release
 * 
 */



#include "head.h"
#include "or.h"
#include "adr.h"

extern char	or_error[];
extern void	err_abrt();
extern int	topParse;

int x400_validate (ad, or, rp)
ADDR	*ad;
OR_ptr	or;
RP_Buf	*rp;
{
	char            tbuf[LINESIZE], tmp[BUFSIZ], *old_rfc822adr = NULLCP;
	char		*ltablepref;
	int             type,
			retval,
			weareTopParse = FALSE;

	if (or_checktypes (or, tmp) == NOTOK) {
		or_free (or);
		PP_LOG (LLOG_EXCEPTIONS, ("Bad OR address '%s'", tmp));
		ad -> ad_parse_stat = RP_BAD;
		ad -> ad_parse_message = strdup (tmp);
		return RP_BAD;
	}

	if (or_check (&or, tbuf, &type, &ltablepref) == NOTOK) {
		or_free (or);
		PP_DBG (("x400_validate/OR_check failed '%s'",or_error));
		ad->ad_parse_stat = RP_BAD;
		ad->ad_parse_message = strdup(or_error);
		return RP_BAD;
	}

	PP_DBG (("x400_validate (tbuf=%s, type=%d)", tbuf, type));

	or_free (or);

	switch (type) {
	case OR_ISLOCAL:
		if (topParse == TRUE) { 
			weareTopParse = TRUE;
			topParse = FALSE;
		}

		if (ad -> ad_r822adr != NULLCP) {
			old_rfc822adr = ad -> ad_r822adr;
			ad -> ad_r822adr = NULLCP;
		}

		retval = ad_local (tbuf, ad, rp, ltablepref);
		
		if (ad -> ad_r822adr == NULLCP) 
			ad -> ad_r822adr = old_rfc822adr;
		else
			free(old_rfc822adr);
			
		if (weareTopParse == TRUE) {
			freeAliasList();
			topParse = TRUE;
		}
		if (!rp_isbad(retval))
			ad->ad_type = AD_X400_TYPE;
		PP_DBG (("x400_validate/local x400 addr %s (%s)",
					tbuf, rp_valstr(retval)));
		return (ad->ad_parse_stat = retval);
	case OR_ISMTA:
		break;
	default:
		err_abrt (RP_MECH, "Illegal return from or_check '%d'",type);
	}


	if (ad->ad_outchan == NULLIST_RCHAN)
		if (tb_getchan (tbuf, &ad->ad_outchan) != OK) {
			(void) sprintf (tmp, "Unknown domain '%s'",tbuf);
			ad->ad_parse_message = strdup(tmp);
			return parselose (rp, ad->ad_parse_stat = RP_BAD,
				       "Unknown domain '%s'", tbuf);
		}
	ad->ad_type = AD_X400_TYPE;
	return (ad->ad_parse_stat = RP_AOK);
}