char *dbname = 0;
char *defrealm;
int keytypedone = 0;
- krb5_enctype etype = 0xffff;
+ krb5_enctype etype = DEFAULT_KDC_ETYPE;
int sci_idx, code;
extern krb5_kt_ops krb5_ktf_writable_ops;
char *request = NULL;
}
}
+ /* Dump creates files which should not be world-readable. It is easiest
+ to do a single umask call here; any shells run by the ss command
+ interface will have umask = 77 but that is not a serious problem. */
+ (void) umask(077);
if (retval = krb5_kt_register(&krb5_ktf_writable_ops)) {
com_err(progname, retval,
exit(1);
}
- if (etype == 0xffff)
- etype = DEFAULT_KDC_ETYPE;
-
if (!valid_etype(etype)) {
com_err(progname, KRB5_PROG_ETYPE_NOSUPP,
"while setting up etype %d", etype);
exit(0);
}
+#define NO_PRINC ((krb5_kvno)-1)
+
krb5_kvno
princ_exists(pname, principal)
char *pname;
return 0;
}
if (!nprincs)
- return 0;
+ return NO_PRINC;
vno = entry.kvno;
krb5_db_free_principal(&entry, nprincs);
return(vno);
com_err(cmdname, retval, "while parsing '%s'", argv[1]);
return;
}
- if (princ_exists(cmdname, newprinc)) {
+ if (princ_exists(cmdname, newprinc) != NO_PRINC) {
com_err(cmdname, 0, "principal '%s' already exists", argv[1]);
krb5_free_principal(newprinc);
return;
com_err(argv[0], retval, "while parsing '%s'", argv[1]);
return;
}
- if (princ_exists(argv[0], newprinc)) {
+ if (princ_exists(argv[0], newprinc) != NO_PRINC) {
com_err(argv[0], 0, "principal '%s' already exists", argv[1]);
krb5_free_principal(newprinc);
return;
com_err(argv[0], retval, "while parsing '%s'", argv[1]);
return;
}
- if (princ_exists(argv[0], newprinc)) {
+ if (princ_exists(argv[0], newprinc) != NO_PRINC) {
com_err(argv[0], 0, "principal '%s' already exists", argv[1]);
krb5_free_principal(newprinc);
return;
com_err(argv[0], retval, "while parsing '%s'", argv[1]);
return;
}
- if (!princ_exists(argv[0], newprinc)) {
+ if (princ_exists(argv[0], newprinc) == NO_PRINC) {
com_err(argv[0], 0, "principal '%s' is not in the database", argv[1]);
krb5_free_principal(newprinc);
return;
com_err(argv[0], retval, "while parsing '%s'", argv[1]);
return;
}
- if (!(vno = princ_exists(argv[0], newprinc))) {
+ if ((vno = princ_exists(argv[0], newprinc)) == NO_PRINC) {
com_err(argv[0], 0, "No principal '%s' exists", argv[1]);
krb5_free_principal(newprinc);
return;
com_err(cmdname, retval, "while parsing '%s'", argv[1]);
return;
}
- if (!(vno = princ_exists(argv[0], newprinc))) {
+ if ((vno = princ_exists(argv[0], newprinc)) == NO_PRINC) {
com_err(cmdname, 0, "No principal '%s' exists!", argv[1]);
krb5_free_principal(newprinc);
return;
com_err(argv[0], retval, "while parsing '%s'", argv[1]);
return;
}
- if (!(vno = princ_exists(argv[0], newprinc))) {
+ if ((vno = princ_exists(argv[0], newprinc)) == NO_PRINC) {
com_err(argv[0], 0, "No principal '%s' exists!", argv[1]);
krb5_free_principal(newprinc);
return;