fix aliasing issues and remove gcc hacks.

This commit is contained in:
christos 2011-08-17 09:03:47 +00:00
parent e9d191bffa
commit 3392b60945
4 changed files with 19 additions and 34 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.8 2011/06/22 02:49:42 mrg Exp $
# $NetBSD: Makefile,v 1.9 2011/08/17 09:03:47 christos Exp $
.include "${.CURDIR}/../Makefile.inc"
@ -44,10 +44,6 @@ LDADD+= -lssl -lcrypto
SRCS+= info_nis.c
.endif
.if defined(HAVE_GCC)
COPTS.amq_subr.c+= -fno-strict-aliasing
.endif
# the following are not supported on NetBSD
# info_ldap.c info_nisplus.c ops_cachefs.c ops_efs.c ops_lofs.c ops_xfs.c
MAN+= amd.8
@ -83,8 +79,3 @@ build_version.h: get_args.c
.include <bsd.prog.mk>
# XXX
.if ${HAVE_GCC} == 45
COPTS.readdir.c+= -fno-strict-aliasing
.endif

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.3 2011/06/20 07:43:57 mrg Exp $
# $NetBSD: Makefile,v 1.4 2011/08/17 09:03:47 christos Exp $
.include "${.CURDIR}/../Makefile.inc"
@ -13,9 +13,4 @@ MAN+= amq.8
CPPFLAGS+= -I${DIST}
LDADD+= ${LIBAMU}
.if defined(HAVE_GCC)
COPTS.amq_xdr.c+= -fno-strict-aliasing
COPTS.amq.c+= -fno-strict-aliasing
.endif
.include <bsd.prog.mk>

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.2 2011/06/22 02:49:42 mrg Exp $
# $NetBSD: Makefile,v 1.3 2011/08/17 09:03:47 christos Exp $
.include "${.CURDIR}/../Makefile.inc"
@ -14,8 +14,3 @@ CPPFLAGS+= -I${DIST}
LDADD+= ${LIBAMU} -lrpcsvc
.include <bsd.prog.mk>
# XXX
.if ${HAVE_GCC} == 45
COPTS.stubs.c+= -fno-strict-aliasing
.endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: stubs.c,v 1.1.1.2 2009/03/20 20:26:55 christos Exp $ */
/* $NetBSD: stubs.c,v 1.2 2011/08/17 09:03:47 christos Exp $ */
/*
* Copyright (c) 1997-2009 Erez Zadok
@ -166,8 +166,9 @@ nfsproc_getattr_2_svc(am_nfs_fh *argp, struct svc_req *rqstp)
if (gid != hlfs_gid) {
res.ns_status = NFSERR_STALE;
} else {
memset((char *) &uid, 0, sizeof(int));
uid = *(u_int *) argp->fh_data;
u_int xuid;
memcpy(&xuid, argp->fh_data, sizeof(xuid));
uid = xuid;
if (plt_search(uid) != (uid2home_t *) NULL) {
res.ns_status = NFS_OK;
un_fattr.na_fileid = uid;
@ -282,13 +283,15 @@ nfsproc_lookup_2_svc(nfsdiropargs *argp, struct svc_req *rqstp)
res.dr_status = NFSERR_NOENT;
return &res;
} else { /* entry found and gid is permitted */
u_int xuid;
un_fattr.na_fileid = untab[idx].uid;
res.dr_u.dr_drok_u.drok_attributes = un_fattr;
memset((char *) &un_fhandle, 0, sizeof(am_nfs_fh));
*(u_int *) un_fhandle.fh_data = (u_int) untab[idx].uid;
xstrlcpy((char *) &un_fhandle.fh_data[sizeof(int)],
memset(&un_fhandle, 0, sizeof(am_nfs_fh));
xuid = (u_int) untab[idx].uid;
memcpy(un_fhandle.fh_data, &xuid, sizeof(xuid));
xstrlcpy((char *) &un_fhandle.fh_data[sizeof(xuid)],
untab[idx].username,
sizeof(am_nfs_fh) - sizeof(int));
sizeof(am_nfs_fh) - sizeof(xuid));
res.dr_u.dr_drok_u.drok_fhandle = un_fhandle;
res.dr_status = NFS_OK;
dlog("nfs_lookup: successful lookup for uid=%ld, gid=%ld: username=%s",
@ -309,7 +312,7 @@ nfsproc_readlink_2_svc(am_nfs_fh *argp, struct svc_req *rqstp)
uid_t userid = (uid_t) INVALIDID;
gid_t groupid = hlfs_gid + 1; /* anything not hlfs_gid */
int retval = 0;
char *path_val = (char *) NULL;
char *path_val = NULL;
char *username;
static uid_t last_uid = (uid_t) INVALIDID;
@ -330,7 +333,7 @@ nfsproc_readlink_2_svc(am_nfs_fh *argp, struct svc_req *rqstp)
* processing, by getting a NULL returned as a
* "special". Child returns result.
*/
return (nfsreadlinkres *) NULL;
return NULL;
}
} else { /* check if asked for user mailbox */
@ -340,9 +343,10 @@ nfsproc_readlink_2_svc(am_nfs_fh *argp, struct svc_req *rqstp)
}
if (groupid == hlfs_gid) {
memset((char *) &userid, 0, sizeof(int));
userid = *(u_int *) argp->fh_data;
username = (char *) &argp->fh_data[sizeof(int)];
u_int xuserid;
memcpy(&xuserid, argp->fh_data, sizeof(xuserid));
userid = xuserid;
username = (char *) &argp->fh_data[sizeof(xuserid)];
if (!(res.rlr_u.rlr_data_u = mailbox(userid, username)))
return (nfsreadlinkres *) NULL;
} else {