mountd.c (144841) | mountd.c (146187) |
---|---|
1/* 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Herb Hasler and Rick Macklem at The University of Guelph. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 29 unchanged lines hidden (view full) --- 38 39#if 0 40#ifndef lint 41static char sccsid[] = "@(#)mountd.c 8.15 (Berkeley) 5/1/95"; 42#endif /*not lint*/ 43#endif 44 45#include <sys/cdefs.h> | 1/* 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Herb Hasler and Rick Macklem at The University of Guelph. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 29 unchanged lines hidden (view full) --- 38 39#if 0 40#ifndef lint 41static char sccsid[] = "@(#)mountd.c 8.15 (Berkeley) 5/1/95"; 42#endif /*not lint*/ 43#endif 44 45#include <sys/cdefs.h> |
46__FBSDID("$FreeBSD: head/usr.sbin/mountd/mountd.c 144841 2005-04-09 14:59:10Z stefanf $"); | 46__FBSDID("$FreeBSD: head/usr.sbin/mountd/mountd.c 146187 2005-05-13 16:31:11Z ume $"); |
47 48#include <sys/param.h> 49#include <sys/mount.h> 50#include <sys/fcntl.h> 51#include <sys/stat.h> 52#include <sys/syslog.h> 53#include <sys/sysctl.h> 54#include <sys/linker.h> --- 167 unchanged lines hidden (view full) --- 222int force_v2 = 0; 223int resvport_only = 1; 224int dir_only = 1; 225int dolog = 0; 226int got_sighup = 0; 227 228int opt_flags; 229static int have_v6 = 1; | 47 48#include <sys/param.h> 49#include <sys/mount.h> 50#include <sys/fcntl.h> 51#include <sys/stat.h> 52#include <sys/syslog.h> 53#include <sys/sysctl.h> 54#include <sys/linker.h> --- 167 unchanged lines hidden (view full) --- 222int force_v2 = 0; 223int resvport_only = 1; 224int dir_only = 1; 225int dolog = 0; 226int got_sighup = 0; 227 228int opt_flags; 229static int have_v6 = 1; |
230#ifdef NI_WITHSCOPEID 231static const int ninumeric = NI_NUMERICHOST | NI_WITHSCOPEID; 232#else 233static const int ninumeric = NI_NUMERICHOST; 234#endif | |
235 236int mountdlockfd; 237/* Bits for opt_flags above */ 238#define OP_MAPROOT 0x01 239#define OP_MAPALL 0x02 240/* 0x4 free */ 241#define OP_MASK 0x08 242#define OP_NET 0x10 --- 1444 unchanged lines hidden (view full) --- 1687 if (ecode != 0) { 1688 syslog(LOG_ERR,"can't get address info for host %s", cp); 1689 return 1; 1690 } 1691 grp->gr_ptr.gt_addrinfo = ai; 1692 while (ai != NULL) { 1693 if (ai->ai_canonname == NULL) { 1694 if (getnameinfo(ai->ai_addr, ai->ai_addrlen, host, | 230 231int mountdlockfd; 232/* Bits for opt_flags above */ 233#define OP_MAPROOT 0x01 234#define OP_MAPALL 0x02 235/* 0x4 free */ 236#define OP_MASK 0x08 237#define OP_NET 0x10 --- 1444 unchanged lines hidden (view full) --- 1682 if (ecode != 0) { 1683 syslog(LOG_ERR,"can't get address info for host %s", cp); 1684 return 1; 1685 } 1686 grp->gr_ptr.gt_addrinfo = ai; 1687 while (ai != NULL) { 1688 if (ai->ai_canonname == NULL) { 1689 if (getnameinfo(ai->ai_addr, ai->ai_addrlen, host, |
1695 sizeof host, NULL, 0, ninumeric) != 0) | 1690 sizeof host, NULL, 0, NI_NUMERICHOST) != 0) |
1696 strlcpy(host, "?", sizeof(host)); 1697 ai->ai_canonname = strdup(host); 1698 ai->ai_flags |= AI_CANONNAME; 1699 } 1700 if (debug) 1701 fprintf(stderr, "got host %s\n", ai->ai_canonname); 1702 /* 1703 * Sanity check: make sure we don't already have an entry --- 300 unchanged lines hidden (view full) --- 2004 } else { 2005 /* The specified sockaddr is a network address. */ 2006 bcopy(sa, &net->nt_net, sa->sa_len); 2007 2008 /* Get a network name for the export list. */ 2009 if (np) { 2010 name = np->n_name; 2011 } else if (getnameinfo(sa, sa->sa_len, netname, sizeof netname, | 1691 strlcpy(host, "?", sizeof(host)); 1692 ai->ai_canonname = strdup(host); 1693 ai->ai_flags |= AI_CANONNAME; 1694 } 1695 if (debug) 1696 fprintf(stderr, "got host %s\n", ai->ai_canonname); 1697 /* 1698 * Sanity check: make sure we don't already have an entry --- 300 unchanged lines hidden (view full) --- 1999 } else { 2000 /* The specified sockaddr is a network address. */ 2001 bcopy(sa, &net->nt_net, sa->sa_len); 2002 2003 /* Get a network name for the export list. */ 2004 if (np) { 2005 name = np->n_name; 2006 } else if (getnameinfo(sa, sa->sa_len, netname, sizeof netname, |
2012 NULL, 0, ninumeric) == 0) { | 2007 NULL, 0, NI_NUMERICHOST) == 0) { |
2013 name = netname; 2014 } else { 2015 goto fail; 2016 } 2017 if ((net->nt_name = strdup(name)) == NULL) 2018 out_of_mem(); 2019 2020 /* --- 524 unchanged lines hidden --- | 2008 name = netname; 2009 } else { 2010 goto fail; 2011 } 2012 if ((net->nt_name = strdup(name)) == NULL) 2013 out_of_mem(); 2014 2015 /* --- 524 unchanged lines hidden --- |