1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 3*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 4*7c478bd9Sstevel@tonic-gate */ 5*7c478bd9Sstevel@tonic-gate 6*7c478bd9Sstevel@tonic-gate #ifdef RPC_XDR 7*7c478bd9Sstevel@tonic-gate %#include "iprop.h" 8*7c478bd9Sstevel@tonic-gate #endif /* RPC_XDR */ 9*7c478bd9Sstevel@tonic-gate 10*7c478bd9Sstevel@tonic-gate /* 11*7c478bd9Sstevel@tonic-gate * Initial declarations 12*7c478bd9Sstevel@tonic-gate */ 13*7c478bd9Sstevel@tonic-gate 14*7c478bd9Sstevel@tonic-gate #ifndef RPC_HDR 15*7c478bd9Sstevel@tonic-gate typedef short int16_t; 16*7c478bd9Sstevel@tonic-gate typedef unsigned short uint16_t; 17*7c478bd9Sstevel@tonic-gate typedef int int32_t; 18*7c478bd9Sstevel@tonic-gate typedef unsigned int uint32_t; 19*7c478bd9Sstevel@tonic-gate typedef hyper int64_t; 20*7c478bd9Sstevel@tonic-gate typedef unsigned hyper uint64_t; 21*7c478bd9Sstevel@tonic-gate #endif /* !RPC_HDR */ 22*7c478bd9Sstevel@tonic-gate 23*7c478bd9Sstevel@tonic-gate typedef opaque utf8str_t<>; 24*7c478bd9Sstevel@tonic-gate 25*7c478bd9Sstevel@tonic-gate /* 26*7c478bd9Sstevel@tonic-gate * Transaction log serial no. 27*7c478bd9Sstevel@tonic-gate */ 28*7c478bd9Sstevel@tonic-gate typedef uint32_t kdb_sno_t; 29*7c478bd9Sstevel@tonic-gate 30*7c478bd9Sstevel@tonic-gate /* Timestamp */ 31*7c478bd9Sstevel@tonic-gate struct kdbe_time_t { 32*7c478bd9Sstevel@tonic-gate uint32_t seconds; 33*7c478bd9Sstevel@tonic-gate uint32_t useconds; 34*7c478bd9Sstevel@tonic-gate }; 35*7c478bd9Sstevel@tonic-gate 36*7c478bd9Sstevel@tonic-gate /* Key Data */ 37*7c478bd9Sstevel@tonic-gate struct kdbe_key_t { 38*7c478bd9Sstevel@tonic-gate int32_t k_ver; /* Version */ 39*7c478bd9Sstevel@tonic-gate int32_t k_kvno; /* Key version no. */ 40*7c478bd9Sstevel@tonic-gate int32_t k_enctype<>; 41*7c478bd9Sstevel@tonic-gate utf8str_t k_contents<>; 42*7c478bd9Sstevel@tonic-gate }; 43*7c478bd9Sstevel@tonic-gate 44*7c478bd9Sstevel@tonic-gate /* Content data */ 45*7c478bd9Sstevel@tonic-gate struct kdbe_data_t { 46*7c478bd9Sstevel@tonic-gate int32_t k_magic; 47*7c478bd9Sstevel@tonic-gate utf8str_t k_data; 48*7c478bd9Sstevel@tonic-gate }; 49*7c478bd9Sstevel@tonic-gate 50*7c478bd9Sstevel@tonic-gate /* Principal Data */ 51*7c478bd9Sstevel@tonic-gate struct kdbe_princ_t { 52*7c478bd9Sstevel@tonic-gate utf8str_t k_realm; 53*7c478bd9Sstevel@tonic-gate kdbe_data_t k_components<>; 54*7c478bd9Sstevel@tonic-gate int32_t k_nametype; 55*7c478bd9Sstevel@tonic-gate }; 56*7c478bd9Sstevel@tonic-gate 57*7c478bd9Sstevel@tonic-gate /* TL data (pre-auth specific data) */ 58*7c478bd9Sstevel@tonic-gate struct kdbe_tl_t { 59*7c478bd9Sstevel@tonic-gate int16_t tl_type; 60*7c478bd9Sstevel@tonic-gate opaque tl_data<>; 61*7c478bd9Sstevel@tonic-gate }; 62*7c478bd9Sstevel@tonic-gate 63*7c478bd9Sstevel@tonic-gate /* Structure to store pwd history */ 64*7c478bd9Sstevel@tonic-gate typedef kdbe_key_t kdbe_pw_hist_t<>; 65*7c478bd9Sstevel@tonic-gate 66*7c478bd9Sstevel@tonic-gate /* Basic KDB entry attributes */ 67*7c478bd9Sstevel@tonic-gate enum kdbe_attr_type_t { 68*7c478bd9Sstevel@tonic-gate AT_ATTRFLAGS = 0, 69*7c478bd9Sstevel@tonic-gate AT_MAX_LIFE = 1, 70*7c478bd9Sstevel@tonic-gate AT_MAX_RENEW_LIFE = 2, 71*7c478bd9Sstevel@tonic-gate AT_EXP = 3, 72*7c478bd9Sstevel@tonic-gate AT_PW_EXP = 4, 73*7c478bd9Sstevel@tonic-gate AT_LAST_SUCCESS = 5, 74*7c478bd9Sstevel@tonic-gate AT_LAST_FAILED = 6, 75*7c478bd9Sstevel@tonic-gate AT_FAIL_AUTH_COUNT = 7, 76*7c478bd9Sstevel@tonic-gate AT_PRINC = 8, 77*7c478bd9Sstevel@tonic-gate AT_KEYDATA = 9, 78*7c478bd9Sstevel@tonic-gate AT_TL_DATA = 10, 79*7c478bd9Sstevel@tonic-gate AT_LEN = 11, 80*7c478bd9Sstevel@tonic-gate AT_MOD_PRINC = 12, 81*7c478bd9Sstevel@tonic-gate AT_MOD_TIME = 13, 82*7c478bd9Sstevel@tonic-gate AT_MOD_WHERE = 14, 83*7c478bd9Sstevel@tonic-gate AT_PW_LAST_CHANGE = 15, 84*7c478bd9Sstevel@tonic-gate AT_PW_POLICY = 16, 85*7c478bd9Sstevel@tonic-gate AT_PW_POLICY_SWITCH = 17, 86*7c478bd9Sstevel@tonic-gate AT_PW_HIST_KVNO = 18, 87*7c478bd9Sstevel@tonic-gate AT_PW_HIST = 19 88*7c478bd9Sstevel@tonic-gate }; 89*7c478bd9Sstevel@tonic-gate 90*7c478bd9Sstevel@tonic-gate /* KDB entry, Attribute=value */ 91*7c478bd9Sstevel@tonic-gate union kdbe_val_t switch (kdbe_attr_type_t av_type) { 92*7c478bd9Sstevel@tonic-gate case AT_ATTRFLAGS: 93*7c478bd9Sstevel@tonic-gate uint32_t av_attrflags; 94*7c478bd9Sstevel@tonic-gate case AT_MAX_LIFE: 95*7c478bd9Sstevel@tonic-gate uint32_t av_max_life; 96*7c478bd9Sstevel@tonic-gate case AT_MAX_RENEW_LIFE: 97*7c478bd9Sstevel@tonic-gate uint32_t av_max_renew_life; 98*7c478bd9Sstevel@tonic-gate case AT_EXP: 99*7c478bd9Sstevel@tonic-gate uint32_t av_exp; 100*7c478bd9Sstevel@tonic-gate case AT_PW_EXP: 101*7c478bd9Sstevel@tonic-gate uint32_t av_pw_exp; 102*7c478bd9Sstevel@tonic-gate case AT_LAST_SUCCESS: 103*7c478bd9Sstevel@tonic-gate uint32_t av_last_success; 104*7c478bd9Sstevel@tonic-gate case AT_LAST_FAILED: 105*7c478bd9Sstevel@tonic-gate uint32_t av_last_failed; 106*7c478bd9Sstevel@tonic-gate case AT_FAIL_AUTH_COUNT: 107*7c478bd9Sstevel@tonic-gate uint32_t av_fail_auth_count; 108*7c478bd9Sstevel@tonic-gate case AT_PRINC: 109*7c478bd9Sstevel@tonic-gate kdbe_princ_t av_princ; 110*7c478bd9Sstevel@tonic-gate case AT_KEYDATA: 111*7c478bd9Sstevel@tonic-gate kdbe_key_t av_keydata<>; /* array of keys */ 112*7c478bd9Sstevel@tonic-gate case AT_TL_DATA: 113*7c478bd9Sstevel@tonic-gate kdbe_tl_t av_tldata<>; /* array of TL data */ 114*7c478bd9Sstevel@tonic-gate case AT_LEN: 115*7c478bd9Sstevel@tonic-gate int16_t av_len; 116*7c478bd9Sstevel@tonic-gate case AT_PW_LAST_CHANGE: 117*7c478bd9Sstevel@tonic-gate uint32_t av_pw_last_change; 118*7c478bd9Sstevel@tonic-gate case AT_MOD_PRINC: 119*7c478bd9Sstevel@tonic-gate kdbe_princ_t av_mod_princ; 120*7c478bd9Sstevel@tonic-gate case AT_MOD_TIME: 121*7c478bd9Sstevel@tonic-gate uint32_t av_mod_time; 122*7c478bd9Sstevel@tonic-gate case AT_MOD_WHERE: 123*7c478bd9Sstevel@tonic-gate utf8str_t av_mod_where; 124*7c478bd9Sstevel@tonic-gate case AT_PW_POLICY: 125*7c478bd9Sstevel@tonic-gate utf8str_t av_pw_policy; 126*7c478bd9Sstevel@tonic-gate case AT_PW_POLICY_SWITCH: 127*7c478bd9Sstevel@tonic-gate bool av_pw_policy_switch; 128*7c478bd9Sstevel@tonic-gate case AT_PW_HIST_KVNO: 129*7c478bd9Sstevel@tonic-gate uint32_t av_pw_hist_kvno; 130*7c478bd9Sstevel@tonic-gate case AT_PW_HIST: 131*7c478bd9Sstevel@tonic-gate kdbe_pw_hist_t av_pw_hist<>; /* array of pw history */ 132*7c478bd9Sstevel@tonic-gate default: 133*7c478bd9Sstevel@tonic-gate opaque av_extension<>; /* futures */ 134*7c478bd9Sstevel@tonic-gate }; 135*7c478bd9Sstevel@tonic-gate 136*7c478bd9Sstevel@tonic-gate typedef kdbe_val_t kdbe_t<>; /* Array of attr/val makes a KDB entry */ 137*7c478bd9Sstevel@tonic-gate 138*7c478bd9Sstevel@tonic-gate /* 139*7c478bd9Sstevel@tonic-gate * Incremental update 140*7c478bd9Sstevel@tonic-gate */ 141*7c478bd9Sstevel@tonic-gate struct kdb_incr_update_t { 142*7c478bd9Sstevel@tonic-gate utf8str_t kdb_princ_name; /* Principal name */ 143*7c478bd9Sstevel@tonic-gate kdb_sno_t kdb_entry_sno; /* Serial # of entry */ 144*7c478bd9Sstevel@tonic-gate kdbe_time_t kdb_time; /* Timestamp of update */ 145*7c478bd9Sstevel@tonic-gate kdbe_t kdb_update; /* Attributes modified */ 146*7c478bd9Sstevel@tonic-gate bool kdb_deleted; /* Is this update a DELETION ? */ 147*7c478bd9Sstevel@tonic-gate bool kdb_commit; /* Is the entry committed or not ? */ 148*7c478bd9Sstevel@tonic-gate utf8str_t kdb_kdcs_seen_by<>; /* Names of slaves that have */ 149*7c478bd9Sstevel@tonic-gate /* seen this update - for */ 150*7c478bd9Sstevel@tonic-gate /* future use */ 151*7c478bd9Sstevel@tonic-gate opaque kdb_futures<>; /* futures */ 152*7c478bd9Sstevel@tonic-gate }; 153*7c478bd9Sstevel@tonic-gate 154*7c478bd9Sstevel@tonic-gate /* 155*7c478bd9Sstevel@tonic-gate * Update log body 156*7c478bd9Sstevel@tonic-gate */ 157*7c478bd9Sstevel@tonic-gate typedef kdb_incr_update_t kdb_ulog_t<>; 158*7c478bd9Sstevel@tonic-gate 159*7c478bd9Sstevel@tonic-gate enum update_status_t { 160*7c478bd9Sstevel@tonic-gate UPDATE_OK = 0, 161*7c478bd9Sstevel@tonic-gate UPDATE_ERROR = 1, 162*7c478bd9Sstevel@tonic-gate UPDATE_FULL_RESYNC_NEEDED = 2, 163*7c478bd9Sstevel@tonic-gate UPDATE_BUSY = 3, 164*7c478bd9Sstevel@tonic-gate UPDATE_NIL = 4, 165*7c478bd9Sstevel@tonic-gate UPDATE_PERM_DENIED = 5 166*7c478bd9Sstevel@tonic-gate }; 167*7c478bd9Sstevel@tonic-gate 168*7c478bd9Sstevel@tonic-gate struct kdb_last_t { 169*7c478bd9Sstevel@tonic-gate kdb_sno_t last_sno; 170*7c478bd9Sstevel@tonic-gate kdbe_time_t last_time; 171*7c478bd9Sstevel@tonic-gate }; 172*7c478bd9Sstevel@tonic-gate 173*7c478bd9Sstevel@tonic-gate struct kdb_incr_result_t { 174*7c478bd9Sstevel@tonic-gate kdb_last_t lastentry; 175*7c478bd9Sstevel@tonic-gate kdb_ulog_t updates; 176*7c478bd9Sstevel@tonic-gate update_status_t ret; 177*7c478bd9Sstevel@tonic-gate }; 178*7c478bd9Sstevel@tonic-gate 179*7c478bd9Sstevel@tonic-gate struct kdb_fullresync_result_t { 180*7c478bd9Sstevel@tonic-gate kdb_last_t lastentry; 181*7c478bd9Sstevel@tonic-gate update_status_t ret; 182*7c478bd9Sstevel@tonic-gate }; 183*7c478bd9Sstevel@tonic-gate 184*7c478bd9Sstevel@tonic-gate program KRB5_IPROP_PROG { 185*7c478bd9Sstevel@tonic-gate version KRB5_IPROP_VERS { 186*7c478bd9Sstevel@tonic-gate /* 187*7c478bd9Sstevel@tonic-gate * NULL procedure 188*7c478bd9Sstevel@tonic-gate */ 189*7c478bd9Sstevel@tonic-gate void 190*7c478bd9Sstevel@tonic-gate IPROP_NULL(void) = 0; 191*7c478bd9Sstevel@tonic-gate 192*7c478bd9Sstevel@tonic-gate /* 193*7c478bd9Sstevel@tonic-gate * Keep waiting for and get next incremental update(s) 194*7c478bd9Sstevel@tonic-gate * 195*7c478bd9Sstevel@tonic-gate * Will return latest kdb_vers on the master (if different), 196*7c478bd9Sstevel@tonic-gate * alongwith return value and affected db entries. 197*7c478bd9Sstevel@tonic-gate */ 198*7c478bd9Sstevel@tonic-gate kdb_incr_result_t 199*7c478bd9Sstevel@tonic-gate IPROP_GET_UPDATES(kdb_last_t) = 1; 200*7c478bd9Sstevel@tonic-gate 201*7c478bd9Sstevel@tonic-gate /* 202*7c478bd9Sstevel@tonic-gate * We need to do the full-resync of the db, since the 203*7c478bd9Sstevel@tonic-gate * serial nos./timestamps are way out-of-whack 204*7c478bd9Sstevel@tonic-gate */ 205*7c478bd9Sstevel@tonic-gate kdb_fullresync_result_t 206*7c478bd9Sstevel@tonic-gate IPROP_FULL_RESYNC(void) = 2; 207*7c478bd9Sstevel@tonic-gate } = 1; 208*7c478bd9Sstevel@tonic-gate } = 100423; 209