|
|
1.1 ! root 1: /* dsa_info.c - DSA Operational Information */ ! 2: ! 3: #ifndef lint ! 4: static char *rcsid = "$Header: /f/osi/dsap/common/RCS/dsa_info.c,v 7.0 89/11/23 21:42:10 mrose Rel $"; ! 5: #endif ! 6: ! 7: /* ! 8: * $Header: /f/osi/dsap/common/RCS/dsa_info.c,v 7.0 89/11/23 21:42:10 mrose Rel $ ! 9: * ! 10: * ! 11: * $Log: dsa_info.c,v $ ! 12: * Revision 7.0 89/11/23 21:42:10 mrose ! 13: * Release 6.0 ! 14: * ! 15: */ ! 16: ! 17: /* ! 18: * NOTICE ! 19: * ! 20: * Acquisition, use, and distribution of this module and related ! 21: * materials are subject to the restrictions of a license agreement. ! 22: * Consult the Preface in the User's Manual for the full terms of ! 23: * this agreement. ! 24: * ! 25: */ ! 26: ! 27: ! 28: /* LINTLIBRARY */ ! 29: ! 30: #include "quipu/util.h" ! 31: #include "quipu/entry.h" ! 32: extern LLog * log_dsap; ! 33: ! 34: static edb_info_free (edb) ! 35: struct edb_info * edb; ! 36: { ! 37: if (edb == NULLEDB) ! 38: return; ! 39: ! 40: dn_free (edb->edb_name) ; ! 41: dn_free (edb->edb_getfrom); ! 42: dn_seq_free (edb->edb_allowed); ! 43: dn_seq_free (edb->edb_sendto); ! 44: free ((char *) edb); ! 45: } ! 46: ! 47: static struct edb_info * edb_info_cpy (a) ! 48: struct edb_info * a; ! 49: { ! 50: struct edb_info * result; ! 51: ! 52: result = edb_info_alloc (); ! 53: result->edb_name = dn_cpy (a->edb_name); ! 54: result->edb_getfrom = dn_cpy (a->edb_getfrom); ! 55: result->edb_sendto = dn_seq_cpy (a->edb_sendto); ! 56: result->edb_allowed = dn_seq_cpy (a->edb_allowed); ! 57: return (result); ! 58: } ! 59: ! 60: static edb_info_cmp (a,b) ! 61: struct edb_info * a; ! 62: struct edb_info * b; ! 63: { ! 64: int i; ! 65: ! 66: if (a == NULLEDB) ! 67: return ( b == NULLEDB ? 0 : -1 ); ! 68: ! 69: if (b == NULLEDB) ! 70: return (1); ! 71: ! 72: if ( (i = dn_cmp (a->edb_name,b->edb_name)) != 0) ! 73: return (i); ! 74: ! 75: if ( (i = dn_cmp (a->edb_getfrom,b->edb_getfrom)) != 0) ! 76: return (i); ! 77: ! 78: if ( (i = dn_seq_cmp (a->edb_sendto,b->edb_sendto)) != 0) ! 79: return (i); ! 80: ! 81: if ( (i = dn_seq_cmp (a->edb_allowed,b->edb_allowed)) != 0) ! 82: return (i); ! 83: ! 84: return (0); ! 85: ! 86: } ! 87: ! 88: static struct edb_info * edb_info_decode (pe) ! 89: PE pe; ! 90: { ! 91: struct edb_info * a; ! 92: ! 93: a = edb_info_alloc (); ! 94: if (decode_Quipu_EDBInfoSyntax(pe,1,NULLIP,NULLVP,a) == NOTOK) { ! 95: free ((char *)a); ! 96: return (NULLEDB); ! 97: } ! 98: return (a); ! 99: } ! 100: ! 101: ! 102: static edb_info_print (ps,edb,format) ! 103: PS ps; ! 104: struct edb_info * edb; ! 105: int format; ! 106: { ! 107: if (edb == NULLEDB) ! 108: return; ! 109: ! 110: if (format == READOUT) { ! 111: if (edb->edb_name != NULLDN) ! 112: dn_print (ps,edb->edb_name,EDBOUT); ! 113: else ! 114: ps_print (ps,"ROOT"); ! 115: ! 116: if (edb->edb_getfrom != NULLDN) { ! 117: ps_print (ps," ( FROM "); ! 118: dn_print (ps,edb->edb_getfrom,EDBOUT); ! 119: ps_print (ps, " )"); ! 120: if (edb->edb_allowed != NULLDNSEQ) { ! 121: ps_print (ps,"\n\t\t\t"); ! 122: if (edb->edb_name != NULLDN) ! 123: dn_print (ps,edb->edb_name,EDBOUT); ! 124: else ! 125: ps_print (ps,"ROOT"); ! 126: } ! 127: } ! 128: if (edb->edb_allowed != NULLDNSEQ) { ! 129: ps_print (ps," ( TO "); ! 130: dn_seq_print (ps,edb->edb_allowed,READOUT); ! 131: ps_print (ps, " )"); ! 132: } ! 133: } else { ! 134: if (edb->edb_name != NULLDN) ! 135: dn_print (ps,edb->edb_name,EDBOUT); ! 136: ps_print (ps,"#"); ! 137: dn_print (ps,edb->edb_getfrom,EDBOUT); ! 138: ps_print (ps,"#"); ! 139: dn_seq_print (ps,edb->edb_allowed,format); ! 140: } ! 141: ! 142: if (edb->edb_sendto != NULLDNSEQ) ! 143: DLOG (log_dsap,LLOG_EXCEPTIONS,("edb_sendto not null")); ! 144: ! 145: } ! 146: ! 147: ! 148: static struct edb_info * str2update (str) ! 149: char * str; ! 150: { ! 151: register char * ptr; ! 152: char * save,val; ! 153: struct edb_info * ei; ! 154: ! 155: /* dn # num # dn # dnseq # */ ! 156: if ((ptr = index (str,'#')) == 0) { ! 157: parse_error ("# missing in update syntax '%s'",str); ! 158: return (NULLEDB); ! 159: } ! 160: ei = edb_info_alloc (); ! 161: ei->edb_sendto = NULLDNSEQ; ! 162: ! 163: /* go for name */ ! 164: save = ptr++; ! 165: if (*str == '#') ! 166: ei->edb_name = NULLDN; ! 167: else { ! 168: if (! isspace (*--save)) ! 169: save++; ! 170: val = *save; ! 171: *save = 0; ! 172: ! 173: if ((ei->edb_name = str2dn(str)) == NULLDN) { ! 174: free ((char *) ei); ! 175: return (NULLEDB); ! 176: } ! 177: *save = val; ! 178: } ! 179: ! 180: str = SkipSpace(ptr); ! 181: if ((ptr = index (str,'#')) == 0) { ! 182: parse_error ("2nd # missing in update syntax '%s'",str); ! 183: dn_free (ei->edb_name); ! 184: free ((char *) ei); ! 185: return (NULLEDB); ! 186: } ! 187: ! 188: save = ptr++; ! 189: if (*str == '#') { ! 190: ei->edb_getfrom = NULLDN; ! 191: } else { ! 192: if (! isspace (*--save)) ! 193: save++; ! 194: val = *save; ! 195: *save = 0; ! 196: ! 197: if ((ei->edb_getfrom = str2dn(str)) == NULLDN) { ! 198: dn_free (ei->edb_name); ! 199: free ((char *) ei); ! 200: return (NULLEDB); ! 201: } ! 202: *save = val; ! 203: } ! 204: ! 205: /* send to */ ! 206: str = SkipSpace(ptr); ! 207: if ((ptr = index (str,'#')) == 0) { ! 208: ptr = 0; ! 209: } else { ! 210: save = ptr++; ! 211: if (! isspace (*--save)) ! 212: save++; ! 213: val = *save; ! 214: *save=0; ! 215: } ! 216: ! 217: if (*str == 0) ! 218: ei->edb_allowed = NULLDNSEQ; ! 219: else if ((ei->edb_allowed = str2dnseq(str)) == NULLDNSEQ) { ! 220: parse_error ("invalid dn '%s'",str); ! 221: dn_free (ei->edb_name); ! 222: dn_free (ei->edb_getfrom); ! 223: free ((char *) ei); ! 224: return (NULLEDB); ! 225: } ! 226: ! 227: if (ptr != 0) ! 228: *save = val; ! 229: ! 230: return (ei); ! 231: } ! 232: ! 233: static PE edb_info_enc (ei) ! 234: struct edbinfo * ei; ! 235: { ! 236: PE ret_pe; ! 237: ! 238: (void) encode_Quipu_EDBInfoSyntax (&ret_pe,0,0,NULLCP,ei); ! 239: return (ret_pe); ! 240: } ! 241: ! 242: edbinfo_syntax () ! 243: { ! 244: (void) add_attribute_syntax ("edbinfo", ! 245: (IFP) edb_info_enc, (IFP) edb_info_decode, ! 246: (IFP) str2update, edb_info_print, ! 247: (IFP) edb_info_cpy, edb_info_cmp, ! 248: edb_info_free, NULLCP, ! 249: NULLIFP, TRUE ); ! 250: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.