krb5 commit: Remove ovload.c

ghudson at mit.edu ghudson at mit.edu
Mon Nov 11 17:00:39 EST 2024


https://github.com/krb5/krb5/commit/dc5554394e5a4363b3e109623edbeb9ad6c18a62
commit dc5554394e5a4363b3e109623edbeb9ad6c18a62
Author: Greg Hudson <ghudson at mit.edu>
Date:   Fri Nov 1 13:45:15 2024 -0400

    Remove ovload.c
    
    Commit 23b93fd48bc445005436c5be98a7269b599b1800 removed the only
    caller of process_ov_record(), but left behind the code.  Remove it
    now.

 src/kadmin/dbutil/Makefile.in |   8 +-
 src/kadmin/dbutil/deps        |  22 -----
 src/kadmin/dbutil/ovload.c    | 201 ------------------------------------------
 3 files changed, 4 insertions(+), 227 deletions(-)

diff --git a/src/kadmin/dbutil/Makefile.in b/src/kadmin/dbutil/Makefile.in
index 1fa25d2a1..46b8a6e8b 100644
--- a/src/kadmin/dbutil/Makefile.in
+++ b/src/kadmin/dbutil/Makefile.in
@@ -6,13 +6,13 @@ KDB_DEP_LIB=$(DL_LIB) $(THREAD_LINKOPTS)
 PROG = kdb5_util
 
 SRCS = kdb5_util.c kdb5_create.c kadm5_create.c kdb5_destroy.c \
-	   kdb5_stash.c import_err.c strtok.c dump.c ovload.c kdb5_mkey.c \
-	   tabdump.c tdumputil.c
+	   kdb5_stash.c import_err.c strtok.c dump.c kdb5_mkey.c tabdump.c \
+	   tdumputil.c
 EXTRADEPSRCS = t_tdumputil.c
 
 OBJS = kdb5_util.o kdb5_create.o kadm5_create.o kdb5_destroy.o \
-	   kdb5_stash.o import_err.o strtok.o dump.o ovload.o kdb5_mkey.o \
-	   tabdump.o tdumputil.o
+	   kdb5_stash.o import_err.o strtok.o dump.o kdb5_mkey.o tabdump.o \
+	   tdumputil.o
 
 GETDATE = ../cli/getdate.o
 
diff --git a/src/kadmin/dbutil/deps b/src/kadmin/dbutil/deps
index 8b0965aac..d4d96316e 100644
--- a/src/kadmin/dbutil/deps
+++ b/src/kadmin/dbutil/deps
@@ -128,28 +128,6 @@ $(OUTPRE)dump.$(OBJEXT): $(BUILDTOP)/include/autoconf.h \
   $(top_srcdir)/include/krb5.h $(top_srcdir)/include/krb5/authdata_plugin.h \
   $(top_srcdir)/include/krb5/plugin.h $(top_srcdir)/include/port-sockets.h \
   $(top_srcdir)/include/socket-utils.h dump.c kdb5_util.h
-$(OUTPRE)ovload.$(OBJEXT): $(BUILDTOP)/include/autoconf.h \
-  $(BUILDTOP)/include/gssapi/gssapi.h $(BUILDTOP)/include/gssrpc/types.h \
-  $(BUILDTOP)/include/kadm5/admin.h $(BUILDTOP)/include/kadm5/admin_internal.h \
-  $(BUILDTOP)/include/kadm5/chpass_util_strings.h $(BUILDTOP)/include/kadm5/kadm_err.h \
-  $(BUILDTOP)/include/kadm5/server_internal.h $(BUILDTOP)/include/krb5/krb5.h \
-  $(BUILDTOP)/include/osconf.h $(BUILDTOP)/include/profile.h \
-  $(COM_ERR_DEPS) $(top_srcdir)/include/gssrpc/auth.h \
-  $(top_srcdir)/include/gssrpc/auth_gss.h $(top_srcdir)/include/gssrpc/auth_unix.h \
-  $(top_srcdir)/include/gssrpc/clnt.h $(top_srcdir)/include/gssrpc/rename.h \
-  $(top_srcdir)/include/gssrpc/rpc.h $(top_srcdir)/include/gssrpc/rpc_msg.h \
-  $(top_srcdir)/include/gssrpc/svc.h $(top_srcdir)/include/gssrpc/svc_auth.h \
-  $(top_srcdir)/include/gssrpc/xdr.h $(top_srcdir)/include/iprop.h \
-  $(top_srcdir)/include/iprop_hdr.h $(top_srcdir)/include/k5-buf.h \
-  $(top_srcdir)/include/k5-err.h $(top_srcdir)/include/k5-gmt_mktime.h \
-  $(top_srcdir)/include/k5-int-pkinit.h $(top_srcdir)/include/k5-int.h \
-  $(top_srcdir)/include/k5-platform.h $(top_srcdir)/include/k5-plugin.h \
-  $(top_srcdir)/include/k5-thread.h $(top_srcdir)/include/k5-trace.h \
-  $(top_srcdir)/include/kdb.h $(top_srcdir)/include/kdb_log.h \
-  $(top_srcdir)/include/krb5.h $(top_srcdir)/include/krb5/authdata_plugin.h \
-  $(top_srcdir)/include/krb5/plugin.h $(top_srcdir)/include/port-sockets.h \
-  $(top_srcdir)/include/socket-utils.h import_err.h kdb5_util.h \
-  nstrtok.h ovload.c
 $(OUTPRE)kdb5_mkey.$(OBJEXT): $(BUILDTOP)/include/autoconf.h \
   $(BUILDTOP)/include/gssapi/gssapi.h $(BUILDTOP)/include/gssrpc/types.h \
   $(BUILDTOP)/include/kadm5/admin.h $(BUILDTOP)/include/kadm5/admin_internal.h \
diff --git a/src/kadmin/dbutil/ovload.c b/src/kadmin/dbutil/ovload.c
deleted file mode 100644
index b2e6c00ea..000000000
--- a/src/kadmin/dbutil/ovload.c
+++ /dev/null
@@ -1,201 +0,0 @@
-/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
-#include    <k5-int.h>
-#include    <unistd.h>
-
-#include <kadm5/admin.h>
-#include <kadm5/server_internal.h>
-#include    <kdb.h>
-#include    "import_err.h"
-#include    "kdb5_util.h"
-#include    "nstrtok.h"
-
-#define LINESIZE        32768 /* XXX */
-
-static int
-parse_pw_hist_ent(char *current, osa_pw_hist_ent *hist)
-{
-    int tmp, i, j, ret;
-    char *cp;
-
-    ret = 0;
-    hist->n_key_data = 1;
-
-    hist->key_data = (krb5_key_data *) malloc(hist->n_key_data *
-                                              sizeof(krb5_key_data));
-    if (hist->key_data == NULL)
-        return ENOMEM;
-    memset(hist->key_data, 0, sizeof(krb5_key_data)*hist->n_key_data);
-
-    for (i = 0; i < hist->n_key_data; i++) {
-        krb5_key_data *key_data = &hist->key_data[i];
-
-        key_data->key_data_ver = 1;
-
-        if((cp = nstrtok((char *) NULL, "\t")) == NULL) {
-            com_err(NULL, IMPORT_BAD_RECORD, "%s", current);
-            ret = IMPORT_FAILED;
-            goto done;
-        }
-        key_data->key_data_type[0] = atoi(cp);
-
-        if((cp = nstrtok((char *) NULL, "\t")) == NULL) {
-            com_err(NULL, IMPORT_BAD_RECORD, "%s", current);
-            ret =  IMPORT_FAILED;
-            goto done;
-        }
-        key_data->key_data_length[0] = atoi(cp);
-
-        if((cp = nstrtok((char *) NULL, "\t")) == NULL) {
-            com_err(NULL, IMPORT_BAD_RECORD, "%s", current);
-            ret = IMPORT_FAILED;
-            goto done;
-        }
-        if(!(key_data->key_data_contents[0] =
-             (krb5_octet *) malloc(key_data->key_data_length[0]+1))) {
-            ret = ENOMEM;
-            goto done;
-        }
-        for(j = 0; j < key_data->key_data_length[0]; j++) {
-            if(sscanf(cp, "%02x", &tmp) != 1) {
-                com_err(NULL, IMPORT_BAD_RECORD, "%s", current);
-                ret = IMPORT_FAILED;
-                goto done;
-            }
-            key_data->key_data_contents[0][j] = tmp;
-            cp = strchr(cp, ' ') + 1;
-        }
-    }
-
-done:
-    return ret;
-}
-
-/*
- * Function: parse_principal
- *
- * Purpose: parse principal line in db dump file
- *
- * Arguments:
- *      <return value>  0 on success, error code on failure
- *
- * Requires:
- *      principal database to be opened.
- *      nstrtok(3) to have a valid buffer in memory.
- *
- * Effects:
- *      [effects]
- *
- * Modifies:
- *      [modifies]
- *
- */
-int
-process_ov_principal(krb5_context kcontext, const char *fname, FILE *filep,
-                     krb5_boolean verbose, int *linenop)
-{
-    XDR                     xdrs;
-    osa_princ_ent_t         rec;
-    krb5_error_code         ret;
-    krb5_tl_data            tl_data;
-    krb5_principal          princ;
-    krb5_db_entry           *kdb = NULL;
-    char                    *current = 0;
-    char                    *cp;
-    unsigned int            x;
-    char                    line[LINESIZE];
-
-    if (fgets(line, LINESIZE, filep) == (char *) NULL) {
-        return IMPORT_BAD_FILE;
-    }
-    if((cp = nstrtok(line, "\t")) == NULL)
-        return IMPORT_BAD_FILE;
-    if((rec = (osa_princ_ent_t) malloc(sizeof(osa_princ_ent_rec))) == NULL)
-        return ENOMEM;
-    memset(rec, 0, sizeof(osa_princ_ent_rec));
-    if((ret = krb5_parse_name(kcontext, cp, &princ)))
-        goto done;
-    krb5_unparse_name(kcontext, princ, &current);
-    if((cp = nstrtok((char *) NULL, "\t")) == NULL) {
-        com_err(NULL, IMPORT_BAD_RECORD, "%s", current);
-        ret =  IMPORT_FAILED;
-        goto done;
-    } else {
-        if(strcmp(cp, "")) {
-            if((rec->policy = strdup(cp)) == NULL)  {
-                ret = ENOMEM;
-                goto done;
-            }
-        } else rec->policy = NULL;
-    }
-    if((cp = nstrtok((char *) NULL, "\t")) == NULL) {
-        com_err(NULL, IMPORT_BAD_RECORD, "%s", current);
-        ret = IMPORT_FAILED;
-        goto done;
-    }
-    rec->aux_attributes = strtol(cp, (char  **)NULL, 16);
-    if((cp = nstrtok((char *) NULL, "\t")) == NULL) {
-        com_err(NULL, IMPORT_BAD_RECORD, "%s", current);
-        ret = IMPORT_FAILED;
-        goto done;
-    }
-    rec->old_key_len = atoi(cp);
-    if((cp = nstrtok((char *) NULL, "\t")) == NULL) {
-        com_err(NULL, IMPORT_BAD_RECORD, "%s", current);
-        ret = IMPORT_FAILED;
-        goto done;
-    }
-    rec->old_key_next = atoi(cp);
-    if((cp = nstrtok((char *) NULL, "\t")) == NULL) {
-        com_err(NULL, IMPORT_BAD_RECORD, "%s", current);
-        ret = IMPORT_FAILED;
-        goto done;
-    }
-    rec->admin_history_kvno = atoi(cp);
-    if (! rec->old_key_len) {
-        rec->old_keys = NULL;
-    } else {
-        if(!(rec->old_keys = (osa_pw_hist_ent *)
-             malloc(sizeof(osa_pw_hist_ent) * rec->old_key_len))) {
-            ret = ENOMEM;
-            goto done;
-        }
-        memset(rec->old_keys,0,
-               sizeof(osa_pw_hist_ent) * rec->old_key_len);
-        for(x = 0; x < rec->old_key_len; x++)
-            parse_pw_hist_ent(current, &rec->old_keys[x]);
-    }
-
-    xdralloc_create(&xdrs, XDR_ENCODE);
-    if (! xdr_osa_princ_ent_rec(&xdrs, rec)) {
-        xdr_destroy(&xdrs);
-        ret = KADM5_XDR_FAILURE;
-        goto done;
-    }
-
-    tl_data.tl_data_type = KRB5_TL_KADM_DATA;
-    tl_data.tl_data_length = xdr_getpos(&xdrs);
-    tl_data.tl_data_contents = (krb5_octet *) xdralloc_getdata(&xdrs);
-
-    ret = krb5_db_get_principal(kcontext, princ, 0, &kdb);
-    if (ret)
-        goto done;
-
-    ret = krb5_dbe_update_tl_data(kcontext, kdb, &tl_data);
-    if (ret)
-        goto done;
-
-    ret = krb5_db_put_principal(kcontext, kdb);
-    if (ret)
-        goto done;
-
-    xdr_destroy(&xdrs);
-
-    (*linenop)++;
-
-done:
-    free(current);
-    krb5_free_principal(kcontext, princ);
-    osa_free_princ_ent(rec);
-    krb5_db_free_principal(kcontext, kdb);
-    return ret;
-}


More information about the cvs-krb5 mailing list