[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[Nbd] default authorization file is missed



Hello all,
Accordig to nbd-server man page nbd_server.allow is the default file for autorization. But there is no code for it.... On some machines this situation causes segmentation fault (because server->authname is uninitialized pointer !!!).
Maybe attached patch isn't the best solution, but it works perfect.
diff -Naur -w nbd-2.8.0/nbd-server.c nbd-2.8.0-auth-fix/nbd-server.c
--- nbd-2.8.0/nbd-server.c	2005-01-22 21:23:29.000000000 +0300
+++ nbd-2.8.0-auth-fix/nbd-server.c	2005-07-28 16:34:44.652106856 +0400
@@ -145,6 +145,7 @@
 #define F_AUTOREADONLY 8  /**< flag to tell us a file is set to autoreadonly */
 GHashTable *children;
 char pidfname[256]; /**< name of our PID file */
+char default_authname[] = "/etc/nbd_server.allow"; /* default name of security file */
 
 /**
  * Variables associated with a server.
@@ -288,6 +289,7 @@
 
 	serve=g_malloc(sizeof(SERVER));
 	serve->hunksize=OFFT_MAX;
+	serve->authname = default_authname;
 	while((c=getopt_long(argc, argv, "a:cl:mr", long_options, &i))>=0) {
 		switch (c) {
 		case 'r':
@@ -795,7 +797,7 @@
 		err("Size of exported file is too big\n");
 	}
 	else {
-		msg3(LOG_INFO, "size of exported file/device is %Lu", (unsigned long long)client->exportsize);
+		msg3(LOG_INFO, "size of exported file/device is %lu", (unsigned long long)client->exportsize);
 	}
 
 	setmysockopt(client->net);
@@ -945,6 +947,7 @@
 			close(net) ;
 			continue ;
 		}
+		
 		msg2(LOG_INFO,"Authorized client") ;
 		pid=g_malloc(sizeof(pid_t));
 #ifndef NOFORK

Reply to: