EC_INIT;
int mapped_aces = 0;
int dirflag;
- uint32_t *darwin_ace_count = (uint32_t *)rbuf;
+ char *darwin_ace_count = rbuf;
#ifdef HAVE_SOLARIS_ACLS
int ace_count = 0;
ace_t *aces = NULL;
LOG(log_debug, logtype_afpd, "get_and_map_acl: mapped %d ACEs", mapped_aces);
- *darwin_ace_count = htonl(mapped_aces);
*rbuflen += sizeof(darwin_acl_header_t) + (mapped_aces * sizeof(darwin_ace_t));
+ mapped_aces = htonl(mapped_aces);
+ memcpy(darwin_ace_count, &mapped_aces, sizeof(uint32_t));
EC_STATUS(0);
case DIRPBIT_FINFO :
if (isad) {
/* Fixes #2802236 */
- uint16_t *fflags = (uint16_t *)(finder_buf + FINDERINFO_FRFLAGOFF);
- *fflags &= htons(~FINDERINFO_ISHARED);
+ uint16_t fflags;
+ memcpy(&fflags, finder_buf + FINDERINFO_FRFLAGOFF, sizeof(uint16_t));
+ fflags &= htons(~FINDERINFO_ISHARED);
+ memcpy(finder_buf + FINDERINFO_FRFLAGOFF, &fflags, sizeof(uint16_t));
/* #2802236 end */
+
if ( dir->d_did == DIRDID_ROOT ) {
/*
* Alright, we admit it, this is *really* sick!
rply->namelen = CNID_DEV_LEN;
rply->name = (char *)data.data + CNID_DEV_OFS;
-
-
- LOG(log_debug, logtype_cnid, "cnid_getstamp: Returning stamp '%08x'", *(uint32_t *)rply->name);
-
rply->result = CNID_DBD_RES_OK;
return 1;
}
size_t nwritten;
gcry_mpi_t Ma;
char *Ra_binary = NULL;
+ uint16_t uint16;
*rbuflen = 0;
/* Session ID first */
ID = dhxhash(obj);
- *(uint16_t *)rbuf = htons(ID);
+ uint16 = htons(ID);
+ memcpy(rbuf, &uint16, sizeof(uint16_t));
rbuf += 2;
*rbuflen += 2;
*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;
char serverNonce_bin[16];
gcry_cipher_hd_t ctx;
gcry_error_t ctxerror;
+ uint16_t uint16;
*rbuflen = 0;
/* ---- 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;
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, ibuf, ibuflen, rbuf, rbuflen);
else if (retID == ID+1)
#ifdef SHADOWPW
struct spwd *sp;
#endif /* SHADOWPW */
+ uint16_t uint16;
*rbuflen = 0;
/* Session ID first */
ID = dhxhash(obj);
- *(uint16_t *)rbuf = htons(ID);
+ uint16 = htons(ID);
+ memcpy(rbuf, &uint16, sizeof(uint16_t));
rbuf += 2;
*rbuflen += 2;
*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;
char serverNonce_bin[16];
gcry_cipher_hd_t ctx;
gcry_error_t ctxerror;
+ uint16_t uint16;
*rbuflen = 0;
/* ---- 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;
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)
int ret;
uid_t uid;
gid_t gid;
+ uint32_t tmp;
struct passwd *pwd;
struct group *grp;
/* Check if UUID is a client local one */
if (memcmp(uuidp, local_user_uuid, 12) == 0) {
*type = UUID_USER;
- uid = ntohl(*(uint32_t *)(uuidp + 12));
+ memcpy(&tmp, uuidp + 12, sizeof(uint32_t));
+ uid = ntohl(tmp);
if ((pwd = getpwuid(uid)) == NULL) {
/* not found, add negative entry to cache */
add_cachebyuuid(uuidp, "UUID_ENOENT", UUID_ENOENT, 0);
return ret;
} else if (memcmp(uuidp, local_group_uuid, 12) == 0) {
*type = UUID_GROUP;
- gid = ntohl(*(uint32_t *)(uuidp + 12));
+ memcpy(&tmp, uuidp + 12, sizeof(uint32_t));
+ gid = ntohl(tmp);
if ((grp = getgrgid(gid)) == NULL) {
/* not found, add negative entry to cache */
add_cachebyuuid(uuidp, "UUID_ENOENT", UUID_ENOENT, 0);
{
int ret = 0;
unsigned int count = 0;
+ uint16_t uint16;
uint32_t uint32;
char *buf;
/* Check magic and version */
buf = ea->ea_data;
- if (*(uint32_t *)buf != htonl(EA_MAGIC)) {
- LOG(log_error, logtype_afpd, "unpack_header: wrong magic 0x%08x", *(uint32_t *)buf);
+ memcpy(&uint32, buf, sizeof(uint32_t));
+ if (uint32 != htonl(EA_MAGIC)) {
+ LOG(log_error, logtype_afpd, "unpack_header: wrong magic 0x%08x", uint32);
ret = -1;
goto exit;
}
buf += 4;
- if (*(uint16_t *)buf != htons(EA_VERSION)) {
- LOG(log_error, logtype_afpd, "unpack_header: wrong version 0x%04x", *(uint16_t *)buf);
+ memcpy(&uint16, buf, sizeof(uint16_t));
+ if (uint16 != htons(EA_VERSION)) {
+ LOG(log_error, logtype_afpd, "unpack_header: wrong version 0x%04x", uint16);
ret = -1;
goto exit;
}
buf += 2;
/* Get EA count */
- ea->ea_count = ntohs(*(uint16_t *)buf);
+ memcpy(&uint16, buf, sizeof(uint16_t));
+ ea->ea_count = ntohs(uint16);
LOG(log_debug, logtype_afpd, "unpack_header: number of EAs: %u", ea->ea_count);
buf += 2;
{
int fd = -1, err = 0;
char *ptr;
+ uint16_t uint16;
+ uint32_t uint32;
if ((fd = open(uname, O_RDWR | O_CREAT | O_EXCL, 0666 & ~ea->vol->v_umask)) == -1) {
LOG(log_error, logtype_afpd, "ea_create: open race condition with ea header for file: %s", uname);
/* Now init it */
ptr = ea->ea_data;
- *(uint32_t *)ptr = htonl(EA_MAGIC);
+ uint32 = htonl(EA_MAGIC);
+ memcpy(ptr, &uint32, sizeof(uint32_t));
ptr += EA_MAGIC_LEN;
- *(uint16_t *)ptr = htons(EA_VERSION);
+
+ uint16 = htons(EA_VERSION);
+ memcpy(ptr, &uint16, sizeof(uint16_t));
ptr += EA_VERSION_LEN;
- *(uint16_t *)ptr = 0; /* count */
+
+ memset(ptr, 0, 2); /* count */
ea->ea_size = EA_HEADER_SIZE;
ea->ea_inited = EA_INITED;