* k5-int.h: krb5_alt_method, krb5_etype_info_entry length fields
authorEzra Peisach <epeisach@mit.edu>
Tue, 17 Oct 2000 22:57:05 +0000 (22:57 +0000)
committerEzra Peisach <epeisach@mit.edu>
Tue, 17 Oct 2000 22:57:05 +0000 (22:57 +0000)
changed to unsigned int. KRB5_ETYPE_NO_LENGTH defined.  Change
prototype decode_krb5_sam_key to decode_krb5_enc_sam_key which is
what the code says.
krb5int_access - change timeouts, shifts, etc to unsigned ints.

* krb5.hin: krb5_data, krb5_address, krb5_keyblock, krb5_checksum,
krb5_authdata, and krb5_pa_data length fields changed to unsigned
int. krb5_kt_get_name(), krb5_unparse_name_ext(),
krb5_build_principal(), krb5_build_principal_ext(),
krb5_build_principal_va() and krb5_read_password() all take or
return unsigned int lengths.

* port-sockets.h (SOCKET): Under unix, a socket is of type int.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@12773 dc483132-0cff-0310-8789-dd5450dbe970

src/include/ChangeLog
src/include/k5-int.h
src/include/krb5.hin
src/include/port-sockets.h

index 9775f8501069e0d727034d0cfb8fd144e2f91d08..273252ee800d749e4806751d3e2edf13816cf972 100644 (file)
@@ -1,3 +1,20 @@
+2000-10-17  Ezra Peisach  <epeisach@mit.edu>
+
+       * k5-int.h: krb5_alt_method, krb5_etype_info_entry length fields
+       changed to unsigned int. KRB5_ETYPE_NO_LENGTH defined.  Change
+       prototype decode_krb5_sam_key to decode_krb5_enc_sam_key which is
+       what the code says.
+       krb5int_access - change timeouts, shifts, etc to unsigned ints. 
+
+       * krb5.hin: krb5_data, krb5_address, krb5_keyblock, krb5_checksum,
+       krb5_authdata, and krb5_pa_data length fields changed to unsigned
+       int. krb5_kt_get_name(), krb5_unparse_name_ext(),
+       krb5_build_principal(), krb5_build_principal_ext(),
+       krb5_build_principal_va() and krb5_read_password() all take or
+       return unsigned int lengths.
+
+       * port-sockets.h (SOCKET): Under unix, a socket is of type int.
+
 2000-10-03  Ezra Peisach  <epeisach@mit.edu>
 
        * krb5.hin, k5-int.h: krb5_cc_get_name now returns const char *.
index eff33e12d0bfef73f7075bf2b3e053a77968b9d0..03465a48cdb2dcbb5927dd0712c15efdb332c01b 100644 (file)
@@ -295,7 +295,7 @@ struct sockaddr;
 typedef struct _krb5_alt_method {
        krb5_magic      magic;
        krb5_int32      method;
-       int             length;
+       unsigned int    length;
        krb5_octet      *data;
 } krb5_alt_method;
 
@@ -307,10 +307,18 @@ typedef struct _krb5_alt_method {
 typedef struct _krb5_etype_info_entry {
        krb5_magic      magic;
        krb5_enctype    etype;
-       int             length;
+       unsigned int    length;
        krb5_octet      *salt;
 } krb5_etype_info_entry;
 
+/* 
+ *  This is essentially -1 without sign extension which can screw up
+ *  comparisons on 64 bit machines. If the length is this value, then
+ *  the salt data is not present. This is to distinguish between not
+ *  being set and being of 0 length. 
+ */
+#define KRB5_ETYPE_NO_SALT VALID_UINT_BITS
+
 typedef krb5_etype_info_entry ** krb5_etype_info;
 
 /*
@@ -668,8 +676,8 @@ struct krb5_cksumtypes {
  */
 
 void krb5_nfold
-KRB5_PROTOTYPE((int inbits, krb5_const unsigned char *in,
-               int outbits, unsigned char *out));
+KRB5_PROTOTYPE((unsigned int inbits, krb5_const unsigned char *in,
+               unsigned int outbits, unsigned char *out));
 
 krb5_error_code krb5_hmac
 KRB5_PROTOTYPE((krb5_const struct krb5_hash_provider *hash,
@@ -1241,7 +1249,7 @@ krb5_error_code encode_krb5_predicted_sam_response
 krb5_error_code decode_krb5_sam_challenge
        KRB5_PROTOTYPE((const krb5_data *, krb5_sam_challenge **));
 
-krb5_error_code decode_krb5_sam_key
+krb5_error_code decode_krb5_enc_sam_key
        KRB5_PROTOTYPE((const krb5_data *, krb5_sam_key **));
 
 krb5_error_code decode_krb5_enc_sam_response_enc
@@ -1538,10 +1546,10 @@ typedef struct _krb5int_access {
                   struct sockaddr **,
                   int *,
                   int));
-    int krb5_max_skdc_timeout;
-    int krb5_skdc_timeout_shift;
-    int krb5_skdc_timeout_1;
-    int krb5_max_dgram_size;
+    unsigned int krb5_max_skdc_timeout;
+    unsigned int krb5_skdc_timeout_shift;
+    unsigned int krb5_skdc_timeout_1;
+    unsigned int krb5_max_dgram_size;
 } krb5int_access;
 
 #define KRB5INT_ACCESS_VERSION \
index 630327211019b584454fda6e3fe6ab671b22ee49..747c07661667bce84d5ddadd617bb0267066c1d1 100644 (file)
@@ -193,10 +193,19 @@ typedef krb5_error_code   krb5_magic;
 
 typedef struct _krb5_data {
        krb5_magic magic;
-       int length;
+       unsigned int length;
        char FAR *data;
 } krb5_data;
 
+/* 
+ * Hack length for crypto library to use the afs_string_to_key It is
+ * equivalent to -1 without possible sign extension 
+ * We also overload for an unset salt type length - which is also -1, but
+ * hey, why not....
+*/
+#define SALT_TYPE_AFS_LENGTH VALID_UINT_BITS
+#define SALT_TYPE_NO_LENGTH VALID_UINT_BITS
+
 /* Define krb5_const as necessary */
 
 /*
@@ -292,7 +301,7 @@ typedef krb5_const krb5_principal_data FAR *krb5_const_principal;
 typedef struct _krb5_address {
     krb5_magic magic;
     krb5_addrtype addrtype;
-    int length;
+    unsigned int length;
     krb5_octet FAR *contents;
 } krb5_address;
 
@@ -330,7 +339,7 @@ struct _krb5_cryptosystem_entry;
 typedef struct _krb5_keyblock {
     krb5_magic magic;
     krb5_enctype enctype;
-    int length;
+    unsigned int length;
     krb5_octet FAR *contents;
 } krb5_keyblock;
 
@@ -347,7 +356,7 @@ typedef struct _krb5_encrypt_block {
 typedef struct _krb5_checksum {
     krb5_magic magic;
     krb5_cksumtype checksum_type;      /* checksum type */
-    int length;
+    unsigned int length;
     krb5_octet FAR *contents;
 } krb5_checksum;
 
@@ -844,7 +853,7 @@ typedef struct _krb5_ticket_times {
 typedef struct _krb5_authdata {
     krb5_magic magic;
     krb5_authdatatype ad_type;
-    int length;
+    unsigned int length;
     krb5_octet FAR *contents;
 } krb5_authdata;
 
@@ -925,7 +934,7 @@ typedef struct _krb5_last_req_entry {
 typedef struct _krb5_pa_data {
     krb5_magic magic;
     krb5_preauthtype  pa_type;
-    int length;
+    unsigned int length;
     krb5_octet FAR *contents;
 } krb5_pa_data;
 
@@ -1321,7 +1330,7 @@ typedef struct _krb5_kt_ops {
        KRB5_NPROTOTYPE((krb5_context,
                 krb5_keytab,
                 char FAR *,
-                int));
+                unsigned int));
     krb5_error_code (KRB5_CALLCONV *close) 
        KRB5_NPROTOTYPE((krb5_context,
                 krb5_keytab));
@@ -1530,7 +1539,7 @@ KRB5_DLLIMP krb5_error_code KRB5_CALLCONV krb5_unparse_name_ext
        KRB5_PROTOTYPE((krb5_context,
                krb5_const_principal,
                char FAR * FAR *,
-               int FAR *));
+               unsigned int FAR *));
 
 KRB5_DLLIMP krb5_error_code KRB5_CALLCONV krb5_set_principal_realm
        KRB5_PROTOTYPE((krb5_context, krb5_principal, const char FAR *));
@@ -1613,14 +1622,14 @@ KRB5_DLLIMP krb5_error_code KRB5_CALLCONV krb5_get_server_rcache
        KRB5_PROTOTYPE((krb5_context,
                krb5_const krb5_data *, krb5_rcache *));
 KRB5_DLLIMP krb5_error_code KRB5_CALLCONV_C krb5_build_principal_ext
-       KRB5_STDARG_P((krb5_context, krb5_principal FAR *, int, krb5_const char FAR *, ...));
+       KRB5_STDARG_P((krb5_context, krb5_principal FAR *, unsigned int, krb5_const char FAR *, ...));
 KRB5_DLLIMP krb5_error_code KRB5_CALLCONV_C krb5_build_principal
-       KRB5_STDARG_P((krb5_context, krb5_principal FAR *, int, krb5_const char FAR *, ...));
+       KRB5_STDARG_P((krb5_context, krb5_principal FAR *, unsigned int, krb5_const char FAR *, ...));
 #ifdef va_start
 /* XXX depending on varargs include file defining va_start... */
 krb5_error_code krb5_build_principal_va
        KRB5_PROTOTYPE((krb5_context,
-               krb5_principal, int, krb5_const char *, va_list));
+               krb5_principal, unsigned int, krb5_const char *, va_list));
 #endif
 
 KRB5_DLLIMP krb5_error_code KRB5_CALLCONV krb5_425_conv_principal
@@ -2157,7 +2166,7 @@ KRB5_DLLIMP krb5_error_code KRB5_CALLCONV krb5_read_password
                const char FAR *,
                const char FAR *,
                char FAR *,
-               int FAR * ));
+               unsigned int FAR * ));
 krb5_error_code krb5_aname_to_localname
        KRB5_PROTOTYPE((krb5_context,
                krb5_const_principal,
index efb2c944474e228c1a6c6d07313930ccdb100a6c..da7ebc2b6d6616de70e3f318f163f5b6d056e508 100644 (file)
@@ -39,7 +39,7 @@ int win_socket_initialize();
 /*
  * Compatability with WinSock calls on MS-Windows...
  */
-#define        SOCKET          unsigned int
+#define        SOCKET          int
 #define        INVALID_SOCKET  ((SOCKET)~0)
 #define        closesocket     close
 #define        ioctlsocket     ioctl