summaryrefslogtreecommitdiffstats
path: root/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd_encoding.c
diff options
context:
space:
mode:
Diffstat (limited to 'daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd_encoding.c')
-rw-r--r--daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd_encoding.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd_encoding.c b/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd_encoding.c
index 1b6bc6f9c..615ac361f 100644
--- a/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd_encoding.c
+++ b/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd_encoding.c
@@ -52,6 +52,8 @@
#include <lber.h>
#include <time.h>
+#include <endian.h>
+
#include "ipapwd.h"
#include "util.h"
#include "ipa_krb5.h"
@@ -242,13 +244,6 @@ void ipapwd_keyset_free(struct ipapwd_keyset **pkset)
*pkset = NULL;
}
-
-void encode_int16(unsigned int val, unsigned char *p)
-{
- p[1] = (val >> 8) & 0xff;
- p[0] = (val ) & 0xff;
-}
-
static Slapi_Value **encrypt_encode_key(struct ipapwd_krbcfg *krbcfg,
struct ipapwd_data *data,
char **errMesg)
@@ -331,6 +326,7 @@ static Slapi_Value **encrypt_encode_key(struct ipapwd_krbcfg *krbcfg,
krb5_octet *ptr;
krb5_data plain;
krb5_enc_data cipher;
+ krb5_int16 t;
size_t len;
const char *p;
@@ -450,7 +446,8 @@ static Slapi_Value **encrypt_encode_key(struct ipapwd_krbcfg *krbcfg,
goto enc_error;
}
- encode_int16(key.length, ptr);
+ t = htole16(key.length);
+ memcpy(ptr, &t, 2);
plain.length = key.length;
plain.data = (char *)key.contents;