<arg><option>-m</option></arg>
<arg><option>-c</option></arg>
<arg><option>-a <replaceable>timeout</replaceable></option></arg>
+ <arg><option>-l <replaceable>host list</replaceable></option></arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1>
this option is strongly recommended.</para>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><option>host list</option></term>
+ <listitem>
+ <para>This argument should contain a list of IP-addresses
+ for hosts that may connect to the server. Wildcards are
+ <emphasis>not</emphasis> allowed. If the file does not
+ exist, it is ignored (and any host can connect); If the file
+ does exist, but is empty, no host can connect. By default,
+ the name 'nbd_server.allow' is used, and looked for in the
+ current directory, unless nbd-server is compiled as a
+ daemon, in which case it is looked for in the
+ root-directory.
+ </listitem>
+ </varlistentry>
+ </variablelist>
+
+ </refsect1>
</variablelist>
</refsect1>
<refsect1>
</itemizedlist>
</refsect1>
<refsect1>
- <title>FILES</title>
-
- <variablelist>
- <varlistentry>
- <term><filename>nbd_server.allow</filename></term>
- <listitem>
- <para>This file, which must be in the directory where
- nbd-server is invoked, can contain a list of IP-addresses
- for hosts that may connect to the server. Wildcards are
- <b>not</b> allowed.
- </listitem>
- </varlistentry>
- </variablelist>
-
- </refsect1>
- <refsect1>
<title>SEE ALSO</title>
<para>nbd-client (8).</para>
</refsect1>
<refsect1>
<title>AUTHOR</title>
- <para>The NBD kernel module and the NBD tools were written by
- Pavel Machek (pavel@ucw.cz)</para>
+ <para>The NBD kernel module and the NBD tools were originally
+ written by Pavel Machek (pavel@ucw.cz)</para>
+
+ <para>The kernel module is now maintained by Paul Clements
+ (Paul.Clements@steeleye.com), while the userland tools are
+ maintained by &dhusername; (&dhemail;)</para>
<para>This manual page was written by &dhusername; (&dhemail;) for
the &debian; system (but may be used by others). Permission is
// #define ISSERVER
#define MY_NAME "nbd_server"
-/* Authorization file should contain lines with IP addresses of
- clients authorized to use the server. If it does not exist,
- access is permitted.
-
- You may want to set this to an absolute path if you're not using
- -DNODAEMON, since if you don't, nbd-server will look for this file
- in the root-directory ("/"). */
-#define AUTH_FILE "nbd_server.allow"
/* how much space for child PIDs we have by default. Dynamically
allocated, and will be realloc()ed if out of space, so this should
probably be fair for most situations. */
//#undef _IO
/* Deep magic: ioctl.h defines _IO macro (at least on linux) */
-
/* Debugging macros, now nothing goes to syslog unless you say ISSERVER */
#ifdef ISSERVER
#define msg2(a,b) syslog(a,b)
#define msg4(a,b,c,d) do { fprintf(stderr,b,c,d); fputs("\n",stderr) ; } while(0)
#endif
-
#include <sys/ioctl.h>
#include <sys/mount.h> /* For BLKGETSIZE */
char difffilename[256];
unsigned int timeout = 0;
int autoreadonly = 0;
+char *auth_file="nbd_server.allow";
int authorized_client(char *name)
/* 0 - authorization refused, 1 - OK
char line[LINELEN] ;
- if ((f=fopen(AUTH_FILE,"r"))==NULL) {
+ if ((f=fopen(auth_file,"r"))==NULL) {
msg4(LOG_INFO,"Can't open authorization file %s (%s).",
- AUTH_FILE,strerror(errno)) ;
+ auth_file,strerror(errno)) ;
return 1 ;
}
" -r read only\n"
" -m multiple file\n"
" -c copy on write\n"
+ " -l file with list of hosts that are allowed to connect.\n"
" -a maximum idle seconds, terminates when idle time exceeded\n"
" if port is set to 0, stdin is used (for running from inetd)\n"
" if file_to_export contains '%%s', it is substituted with IP\n"
break;
case 'c': flags |=F_COPYONWRITE;
break;
+ case 'l':
+ free(auth_file);
+ if (i+1<argc) {
+ auth_file=argv[++i];
+ } else {
+ fprintf(stderr, "host list file requires an argument");
+ }
+ break;
case 'a':
if (i+1<argc) {
timeout = atoi(argv[i+1]);