|
|
1.1 ! root 1: /* modifyrdn.c - */ ! 2: ! 3: #ifndef lint ! 4: static char *rcsid = "$Header: /f/osi/quipu/dish/RCS/modifyrdn.c,v 7.0 89/11/23 22:20:15 mrose Rel $"; ! 5: #endif ! 6: ! 7: /* ! 8: * $Header: /f/osi/quipu/dish/RCS/modifyrdn.c,v 7.0 89/11/23 22:20:15 mrose Rel $ ! 9: * ! 10: * ! 11: * $Log: modifyrdn.c,v $ ! 12: * Revision 7.0 89/11/23 22:20:15 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: #include "quipu/util.h" ! 29: #include "quipu/modifyrdn.h" ! 30: ! 31: extern DN dn; ! 32: ! 33: #define OPT (!frompipe || rps -> ps_byteno == 0 ? opt : rps) ! 34: #define RPS (!frompipe || opt -> ps_byteno == 0 ? rps : opt) ! 35: extern char frompipe; ! 36: extern PS opt, rps; ! 37: ! 38: call_modifyrdn (argc, argv) ! 39: int argc; ! 40: char **argv; ! 41: { ! 42: struct ds_modifyrdn_arg modrdn_arg; ! 43: struct DSError error; ! 44: RDN newname = NULLRDN; ! 45: DN dnptr; ! 46: DN trail; ! 47: int x; ! 48: char deleterdn = TRUE; ! 49: ! 50: ! 51: if ((argc = service_control (OPT,argc, argv, &modrdn_arg.mra_common)) == -1) ! 52: return; ! 53: ! 54: for (x = 1; x < argc; x++) { ! 55: if (test_arg (argv[x], "-name",2)) { ! 56: if ((newname = str2rdn (argv[++x])) == NULLRDN) { ! 57: ps_printf (OPT,"invalid RDN %s\n",argv[x]); ! 58: return; ! 59: } ! 60: } else if (test_arg (argv[x],"-delete",2)) ! 61: deleterdn = TRUE; ! 62: else if (test_arg (argv[x],"-nodelete",3)) ! 63: deleterdn = FALSE; ! 64: else if (move (argv[x]) == OK) ! 65: continue; ! 66: else { ! 67: ps_printf (OPT,"Unknown option %s\n",argv[x]); ! 68: Usage (argv[0]); ! 69: return; ! 70: } ! 71: } ! 72: ! 73: modrdn_arg.deleterdn = deleterdn; ! 74: modrdn_arg.mra_object = dn; ! 75: if (newname == NULLRDN) { ! 76: ps_print (OPT, "Invalid RDN\n"); ! 77: Usage (argv[0]); ! 78: return; ! 79: } ! 80: modrdn_arg.mra_newrdn = newname; ! 81: ! 82: if (rebind () != OK) ! 83: return; ! 84: ! 85: /* Strong authentication */ ! 86: if (modrdn_arg.mra_common.ca_security != (struct security_parms *) 0) ! 87: { ! 88: struct signature *sign_operation(); ! 89: int encode_DAS_ModifyRDNArgumentData(); ! 90: ! 91: modrdn_arg.mra_common.ca_sig = ! 92: sign_operation((caddr_t)&modrdn_arg, encode_DAS_ModifyRDNArgumentData); ! 93: } ! 94: ! 95: while (ds_modifyrdn (&modrdn_arg, &error) != DS_OK) { ! 96: if (dish_error (OPT, &error) == 0) { ! 97: rdn_free(modrdn_arg.mra_newrdn); ! 98: return; ! 99: } ! 100: modrdn_arg.mra_object = error.ERR_REFERRAL.DSE_ref_candidates->cr_name; ! 101: } ! 102: ! 103: ps_print (RPS, "Modify done\n"); ! 104: delete_cache (dn); /* re-cache when next read */ ! 105: for (dnptr = dn; dnptr->dn_parent != NULLDN; dnptr = dnptr->dn_parent) ! 106: trail = dnptr; ! 107: ! 108: dn_comp_free (dnptr); ! 109: trail->dn_parent = dn_comp_new (rdn_cpy (newname)); ! 110: rdn_free(modrdn_arg.mra_newrdn); ! 111: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.