]> arthur.barton.de Git - netatalk.git/blobdiff - etc/uams/uams_dhx2_passwd.c
Merge branch 'release-3-0-1'
[netatalk.git] / etc / uams / uams_dhx2_passwd.c
index 8d31b9f845b3502eb4935d38a0df5cf6635cfac2..c4a322ad48220ca899783ce5d0a83c17b4a4650c 100644 (file)
@@ -160,6 +160,7 @@ static int dhx2_setup(void *obj, char *ibuf _U_, size_t ibuflen _U_,
 #ifdef SHADOWPW
     struct spwd *sp;
 #endif /* SHADOWPW */
+    uint16_t uint16;
 
     *rbuflen = 0;
 
@@ -209,7 +210,8 @@ static int dhx2_setup(void *obj, char *ibuf _U_, size_t ibuflen _U_,
 
     /* Session ID first */
     ID = dhxhash(obj);
-    *(uint16_t *)rbuf = htons(ID);
+    uint16 = htons(ID);
+    memcpy(rbuf, &uint16, sizeof(uint16_t));
     rbuf += 2;
     *rbuflen += 2;
 
@@ -223,7 +225,8 @@ static int dhx2_setup(void *obj, char *ibuf _U_, size_t ibuflen _U_,
     *rbuflen += 4;
 
     /* len = length of p = PRIMEBITS/8 */
-    *(uint16_t *)rbuf = htons((uint16_t) PRIMEBITS/8);
+    uint16 = htons((uint16_t) PRIMEBITS/8);
+    memcpy(rbuf, &uint16, sizeof(uint16_t));
     rbuf += 2;
     *rbuflen += 2;
 
@@ -348,6 +351,7 @@ static int logincont1(void *obj _U_, struct passwd **uam_pwd _U_,
     char serverNonce_bin[16];
     gcry_cipher_hd_t ctx;
     gcry_error_t ctxerror;
+    uint16_t uint16;
 
     *rbuflen = 0;
 
@@ -435,7 +439,8 @@ static int logincont1(void *obj _U_, struct passwd **uam_pwd _U_,
     /* ---- Start building reply packet ---- */
 
     /* Session ID + 1 first */
-    *(uint16_t *)rbuf = htons(ID+1);
+    uint16 = htons(ID+1);
+    memcpy(rbuf, &uint16, sizeof(uint16_t));
     rbuf += 2;
     *rbuflen += 2;
 
@@ -586,7 +591,8 @@ static int passwd_logincont(void *obj, struct passwd **uam_pwd,
     int ret;
 
     /* check for session id */
-    retID = ntohs(*(uint16_t *)ibuf);
+    memcpy(&retID, ibuf, sizeof(uint16_t));
+    retID = ntohs(retID);
     if (retID == ID)
         ret = logincont1(obj, uam_pwd, ibuf, ibuflen, rbuf, rbuflen);
     else if (retID == ID+1)