summaryrefslogtreecommitdiffstats
path: root/usr.sbin/rpc.ypxfrd
diff options
context:
space:
mode:
authorwpaul <wpaul@FreeBSD.org>1996-07-04 02:29:54 +0000
committerwpaul <wpaul@FreeBSD.org>1996-07-04 02:29:54 +0000
commit46fcb35f238d605cab3323d01846350b7aa22603 (patch)
tree2fe8234d374d7dc0ca1fe90e3d83a430497028e6 /usr.sbin/rpc.ypxfrd
parentc26f3ec39e5c2fa4a8622057dc8491ffbd1fa9a9 (diff)
downloadFreeBSD-src-46fcb35f238d605cab3323d01846350b7aa22603.zip
FreeBSD-src-46fcb35f238d605cab3323d01846350b7aa22603.tar.gz
Add checks for byte order and DB type mismatches. We ignore the
filename argument for now: it's really only useful for .dir/.pag-style ndbm databases, which we don't support anyway.
Diffstat (limited to 'usr.sbin/rpc.ypxfrd')
-rw-r--r--usr.sbin/rpc.ypxfrd/ypxfrd_server.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/usr.sbin/rpc.ypxfrd/ypxfrd_server.c b/usr.sbin/rpc.ypxfrd/ypxfrd_server.c
index dd4fcf3..d1f5e66 100644
--- a/usr.sbin/rpc.ypxfrd/ypxfrd_server.c
+++ b/usr.sbin/rpc.ypxfrd/ypxfrd_server.c
@@ -29,12 +29,12 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: ypxfrd_server.c,v 1.5 1996/06/02 17:34:49 wpaul Exp $
+ * $Id: ypxfrd_server.c,v 1.6 1996/07/04 02:23:11 wpaul Exp $
*/
#include "ypxfrd.h"
#ifndef lint
-static const char rcsid[] = "$Id: ypxfrd_server.c,v 1.5 1996/06/02 17:34:49 wpaul Exp $";
+static const char rcsid[] = "$Id: ypxfrd_server.c,v 1.6 1996/07/04 02:23:11 wpaul Exp $";
#endif /* not lint */
#include <stdio.h>
@@ -46,6 +46,7 @@ static const char rcsid[] = "$Id: ypxfrd_server.c,v 1.5 1996/06/02 17:34:49 wpau
#include <sys/param.h>
#include <sys/uio.h>
#include <sys/fcntl.h>
+#include <machine/endian.h>
#include "ypxfrd_extern.h"
int forked = 0;
@@ -106,6 +107,22 @@ ypxfrd_getmap_1_svc(ypxfr_mapname *argp, struct svc_req *rqstp)
result.xfr_u.xfrstat = XFR_ACCESS;
return(&result);
}
+
+ if (argp->xfr_db_type != XFR_DB_BSD_HASH &&
+ argp->xfr_db_type != XFR_DB_ANY) {
+ result.xfr_u.xfrstat = XFR_DB_TYPE_MISMATCH;
+ return(&result);
+ }
+
+#if BYTE_ORDER == LITTLE_ENDIAN
+ if (argp->xfr_byte_order == XFR_ENDIAN_BIG) {
+#else
+ if (argp->xfr_byte_order == XFR_ENDIAN_LITTLE) {
+#endif
+ result.xfr_u.xfrstat = XFR_DB_ENDIAN_MISMATCH;
+ return(&result);
+ }
+
#ifndef DEBUG
if (children < MAX_CHILDREN && fork()) {
children++;
OpenPOWER on IntegriCloud