]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
* adb.h: Forward declaration of struct _kadm5_server_handle_t added
authorMitchell Berger <mitchb@mit.edu>
Wed, 20 Jun 2001 08:17:07 +0000 (08:17 +0000)
committerMitchell Berger <mitchb@mit.edu>
Wed, 20 Jun 2001 08:17:07 +0000 (08:17 +0000)
(had to be this way because simply having it include server_internal.h
and using the typedef found there causes inclusion in the wrong order).
A pointer to a _kadm5_server_handle_t structure has been added to the
_osa_adb_db_ent_t structure.  This was needed for a frustrating and
non-ideal reason, and it's a bit of a kludge.  Read the lengthy comment
in the file for an explanation of why this was done.  A struct
_kadm5_server_handle_t pointer was added to the prototypes of
osa_adb_init_db and osa_adb_open_policy.

* admin.h: Prototype added for kadm5_get_generation_number.

* admin_xdr.h: Prototypes added for xdr_getgeneration_arg and
xdr_getgeneration_ret.

* kadm_rpc.h: Added struct getgeneration_arg and struct
getgeneration_ret and typedefs for them, defined GET_GENERATION_NUMBER,
added prototypes for getgeneration_4_svc and getgeneration_4.

* kadm_rpc_xdr.c: Added new functions xdr_getgeneration_arg and
xdr_getgeneration_ret.

* server_internal.h: Added prototypes for kdb_put_entry_internal and
kdb_update_generation_number.

git-svn-id: svn://anonsvn.mit.edu/krb5/branches/incremental-propagation-branch@13409 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/kadm5/ChangeLog
src/lib/kadm5/adb.h
src/lib/kadm5/admin.h
src/lib/kadm5/admin_xdr.h
src/lib/kadm5/kadm_rpc.h
src/lib/kadm5/kadm_rpc_xdr.c
src/lib/kadm5/server_internal.h

index 1a1e13f2b4242aa3d59d5615ab8276355f034f11..9ce9c9baa7f5f5fc000fdb48b350b9d51216f447 100644 (file)
@@ -1,3 +1,30 @@
+2001-06-20  Mitchell Berger  <mitchb@mit.edu>
+
+       * adb.h: Forward declaration of struct _kadm5_server_handle_t added
+       (had to be this way because simply having it include server_internal.h
+       and using the typedef found there causes inclusion in the wrong order).
+       A pointer to a _kadm5_server_handle_t structure has been added to the
+       _osa_adb_db_ent_t structure.  This was needed for a frustrating and
+       non-ideal reason, and it's a bit of a kludge.  Read the lengthy comment
+       in the file for an explanation of why this was done.  A struct
+       _kadm5_server_handle_t pointer was added to the prototypes of
+       osa_adb_init_db and osa_adb_open_policy.
+
+       * admin.h: Prototype added for kadm5_get_generation_number.
+
+       * admin_xdr.h: Prototypes added for xdr_getgeneration_arg and
+       xdr_getgeneration_ret.
+
+       * kadm_rpc.h: Added struct getgeneration_arg and struct
+       getgeneration_ret and typedefs for them, defined GET_GENERATION_NUMBER,
+       added prototypes for getgeneration_4_svc and getgeneration_4.
+
+       * kadm_rpc_xdr.c: Added new functions xdr_getgeneration_arg and
+       xdr_getgeneration_ret.
+
+       * server_internal.h: Added prototypes for kdb_put_entry_internal and
+       kdb_update_generation_number.
+
 2001-06-18  Ezra Peisach  <epeisach@mit.edu>
 
 
index 0277aba0751ffc00e9e92e0239da166e27b12f92..dd8f642c6a0ee8820a75012a8a49215e22cc7088 100644 (file)
@@ -33,6 +33,13 @@ typedef      long            osa_adb_ret_t;
 #define OSA_ADB_POLICY_VERSION_MASK    0x12345D00
 #define OSA_ADB_POLICY_VERSION_1       0x12345D01
 
+/* This structure is really defined in server_internal.h, but that file
+ * includes this file, and if this file includes that file, though they are
+ * protected against multiple inclusion, the definition of this structure
+ * and the structure in this file that uses it happen in the wrong order.
+ */
+struct _kadm5_server_handle_t;
+
 typedef struct _osa_adb_db_lock_ent_t {
      FILE      *lockfile;
      char      *filename;
@@ -47,6 +54,18 @@ typedef struct _osa_adb_db_ent_t {
      BTREEINFO btinfo;
      char      *filename;
      osa_adb_lock_t lock;
+     /* XXX Ewww - The handle to the policy db needs a handle to the principal
+      * db because in order to get generation numbers to increase when policies
+      * get added, changed, or deleted, we need to be able to do a kdb_get_entry
+      * on the master principal, and that call takes a handle.  Alternatives
+      * included changing the format of the database (inconvenient to
+      * upgraders), keeping the policy and principal databases in sync
+      * separately (seems wrong since they're dumped together, and really want
+      * to be one database in the future), or reengineering the database
+      * structure right now (seems unreasonable to get done before dinner 8-) ).
+      * --mitchb
+      */
+     struct _kadm5_server_handle_t *kadm5_handle;
 } osa_adb_db_ent, *osa_adb_db_t, *osa_adb_princ_t, *osa_adb_policy_t;
 
 /* an osa_pw_hist_ent stores all the key_datas for a single password */
@@ -105,7 +124,8 @@ osa_adb_ret_t   osa_adb_rename_db(char *filefrom, char *lockfrom,
 osa_adb_ret_t   osa_adb_rename_policy_db(kadm5_config_params *fromparams,
                                         kadm5_config_params *toparams);
 osa_adb_ret_t  osa_adb_init_db(osa_adb_db_t *dbp, char *filename,
-                               char *lockfile, int magic);
+                               char *lockfile, int magic,
+                               struct _kadm5_server_handle_t *kadm5_handle);
 osa_adb_ret_t  osa_adb_fini_db(osa_adb_db_t db, int magic);
 osa_adb_ret_t  osa_adb_get_lock(osa_adb_db_t db, int mode);
 osa_adb_ret_t  osa_adb_release_lock(osa_adb_db_t db);
@@ -116,7 +136,8 @@ osa_adb_ret_t       osa_adb_create_policy_db(kadm5_config_params *params);
 osa_adb_ret_t  osa_adb_destroy_policy_db(kadm5_config_params *params);
 osa_adb_ret_t  osa_adb_open_princ(osa_adb_princ_t *db, char *filename);
 osa_adb_ret_t  osa_adb_open_policy(osa_adb_policy_t *db,
-                                   kadm5_config_params *rparams);
+                                   kadm5_config_params *rparams,
+                                   struct _kadm5_server_handle_t *kadm5_handle);
 osa_adb_ret_t  osa_adb_close_princ(osa_adb_princ_t db);
 osa_adb_ret_t  osa_adb_close_policy(osa_adb_policy_t db);
 osa_adb_ret_t  osa_adb_create_princ(osa_adb_princ_t db,
index 5df8f8ef9e5ddc49b67c69a29fa0ec5eceab053e..cd0d43247a2dd8030f25cfd850eec2b3a42041f4 100644 (file)
@@ -447,6 +447,11 @@ kadm5_ret_t    kadm5_free_key_data(void *server_handle,
 kadm5_ret_t    kadm5_free_name_list(void *server_handle, char **names, 
                                    int count);
 
+#if USE_KADM5_API_VERSION > 1
+kadm5_ret_t    kadm5_get_generation_number(void *server_handle,
+                                          krb5_int32 *generation);
+#endif
+
 #if USE_KADM5_API_VERSION == 1
 /*
  * OVSEC_KADM_API_VERSION_1 should be, if possible, compile-time
index 5a2566ef943a206ae2e53aa6cc8d7c3b5be020c6..1e49ac53faf4d5d89386b4e8565a2deb28b919e5 100644 (file)
@@ -4,7 +4,34 @@
  * $Header$
  * 
  * $Log$
+ * Revision 1.6.2.1  2001/06/20 08:17:06  mitchb
+ * * adb.h: Forward declaration of struct _kadm5_server_handle_t added
+ * (had to be this way because simply having it include server_internal.h
+ * and using the typedef found there causes inclusion in the wrong order).
+ * A pointer to a _kadm5_server_handle_t structure has been added to the
+ * _osa_adb_db_ent_t structure.  This was needed for a frustrating and
+ * non-ideal reason, and it's a bit of a kludge.  Read the lengthy comment
+ * in the file for an explanation of why this was done.  A struct
+ * _kadm5_server_handle_t pointer was added to the prototypes of
+ * osa_adb_init_db and osa_adb_open_policy.
+ *
+ * * admin.h: Prototype added for kadm5_get_generation_number.
+ *
+ * * admin_xdr.h: Prototypes added for xdr_getgeneration_arg and
+ * xdr_getgeneration_ret.
+ *
+ * * kadm_rpc.h: Added struct getgeneration_arg and struct
+ * getgeneration_ret and typedefs for them, defined GET_GENERATION_NUMBER,
+ * added prototypes for getgeneration_4_svc and getgeneration_4.
+ *
+ * * kadm_rpc_xdr.c: Added new functions xdr_getgeneration_arg and
+ * xdr_getgeneration_ret.
+ *
+ * * server_internal.h: Added prototypes for kdb_put_entry_internal and
+ * kdb_update_generation_number.
+ *
  * Revision 1.6  2001/02/18 23:00:08  epeisach
+ *
  *     * server_internal.h: Add prototype for
  *         krb5_free_key_data_contents() which really should be in libkdb.
  *
@@ -108,6 +135,8 @@ bool_t          xdr_gpol_ret(XDR *xdrs, gpol_ret *objp);
 bool_t      xdr_gpols_arg(XDR *xdrs, gpols_arg *objp);
 bool_t      xdr_gpols_ret(XDR *xdrs, gpols_ret *objp);
 bool_t      xdr_getprivs_ret(XDR *xdrs, getprivs_ret *objp);
+bool_t      xdr_getgeneration_arg(XDR *xdrs, getgeneration_arg *objp);
+bool_t      xdr_getgeneration_ret(XDR *xdrs, getgeneration_ret *objp);
 bool_t     xdr_krb5_principal(XDR *xdrs, krb5_principal *objp);
 bool_t     xdr_krb5_octet(XDR *xdrs, krb5_octet *objp);
 bool_t     xdr_krb5_int32(XDR *xdrs, krb5_int32 *objp);
index d546c9472b7d72d4de5286836904d0dbd0dd155e..3ac7a863e52dffc9fab7c60991e431a3e5513c97 100644 (file)
@@ -234,6 +234,20 @@ struct getprivs_ret {
 typedef struct getprivs_ret getprivs_ret;
 bool_t xdr_getprivs_ret();
 
+struct getgeneration_arg {
+       krb5_ui_4 api_version;
+};
+typedef struct getgeneration_arg getgeneration_arg;
+bool_t xdr_getgeneration_arg();
+
+struct getgeneration_ret {
+       krb5_ui_4 api_version;
+       kadm5_ret_t code;
+       krb5_int32 generation;
+};
+typedef struct getgeneration_ret getgeneration_ret;
+bool_t xdr_getgeneration_ret();
+
 #define KADM ((krb5_ui_4)2112)
 #define KADMVERS ((krb5_ui_4)2)
 #define CREATE_PRINCIPAL ((krb5_ui_4)1)
@@ -332,4 +346,10 @@ extern generic_ret *setkey_principal3_1_svc(setkey3_arg *arg,
                                            struct svc_req *rqstp);
 extern generic_ret *setkey_principal3_1(setkey3_arg *argp, CLIENT *clnt);
 
+#define GET_GENERATION_NUMBER ((krb5_ui_4) 22)
+extern getgeneration_ret *getgeneration_4_svc(getgeneration_arg *arg,
+                                           struct svc_req *rqstp);
+extern getgeneration_ret *getgeneration_4(getgeneration_arg *argp,
+                                         CLIENT *clnt);
+
 #endif /* __KADM_RPC_H__ */
index 4424fc0eb9051341a7d7e7596225f9461733f708..63e7b26f0a23e0d273c14e5dfdabc9fd134d32a4 100644 (file)
@@ -920,6 +920,30 @@ bool_t xdr_getprivs_ret(XDR *xdrs, getprivs_ret *objp)
      return TRUE;
 }
 
+bool_t xdr_getgeneration_arg(XDR *xdrs, getgeneration_arg *objp)
+{
+     if (!xdr_ui_4(xdrs, &objp->api_version)) {
+          return (FALSE);
+     }
+     return (TRUE);
+}
+
+bool_t xdr_getgeneration_ret(XDR *xdrs, getgeneration_ret *objp)
+{
+     if (!xdr_ui_4(xdrs, &objp->api_version)) {
+          return (FALSE);
+     }
+     if (!xdr_kadm5_ret_t(xdrs, &objp->code)) {
+          return (FALSE);
+     }
+     if (objp->code == KADM5_OK) {
+          if (!xdr_int32(xdrs, &objp->generation)) {
+              return (FALSE);
+          }
+     }
+     return (TRUE);
+}
+
 bool_t
 xdr_krb5_principal(XDR *xdrs, krb5_principal *objp)
 {
index 4a99d267df0d145806ad9f14b426badda75ed5be..a9fbca1ba5c2541cae88c1fb75593a5b3fe46200 100644 (file)
@@ -52,8 +52,13 @@ krb5_error_code     kdb_free_entry(kadm5_server_handle_t handle,
                                   krb5_db_entry *kdb, osa_princ_ent_rec *adb);
 krb5_error_code     kdb_put_entry(kadm5_server_handle_t handle,
                                  krb5_db_entry *kdb, osa_princ_ent_rec *adb);
+krb5_error_code     kdb_put_entry_internal(kadm5_server_handle_t handle,
+                                          krb5_db_entry *kdb,
+                                          osa_princ_ent_rec *adb, int incgen,
+                                          int updatemod);
 krb5_error_code     kdb_delete_entry(kadm5_server_handle_t handle,
                                     krb5_principal name);
+krb5_error_code     kdb_update_generation_number(kadm5_server_handle_t handle);
 
 int                init_dict(kadm5_config_params *);
 int                find_word(const char *word);