[PATCH 03/19] nfs-utils: gssd - simplify some option handling

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

 



Using PATH_MAX in modern code is almost always a bad idea. Simplify
the code and remove that arbitrary limitation at the same time.

Signed-off-by: David Härdeman <david@xxxxxxxxxxx>
---
 utils/gssd/gssd.c |   12 ++++--------
 utils/gssd/gssd.h |    4 ++--
 2 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/utils/gssd/gssd.c b/utils/gssd/gssd.c
index 5e580e7..6147d30 100644
--- a/utils/gssd/gssd.c
+++ b/utils/gssd/gssd.c
@@ -67,8 +67,8 @@
 #include "krb5_util.h"
 #include "nfslib.h"
 
-static char pipefs_dir[PATH_MAX] = GSSD_PIPEFS_DIR;
-char keytabfile[PATH_MAX] = GSSD_DEFAULT_KEYTAB_FILE;
+static char *pipefs_dir = GSSD_PIPEFS_DIR;
+char *keytabfile = GSSD_DEFAULT_KEYTAB_FILE;
 char ccachedir[PATH_MAX] = GSSD_DEFAULT_CRED_DIR ":" GSSD_USER_CRED_DIR;
 char *ccachesearch[GSSD_MAX_CCACHE_SEARCH + 1];
 int  use_memcache = 0;
@@ -341,14 +341,10 @@ main(int argc, char *argv[])
 				rpc_verbosity++;
 				break;
 			case 'p':
-				strncpy(pipefs_dir, optarg, sizeof(pipefs_dir));
-				if (pipefs_dir[sizeof(pipefs_dir)-1] != '\0')
-					errx(1, "pipefs path name too long");
+				pipefs_dir = optarg;
 				break;
 			case 'k':
-				strncpy(keytabfile, optarg, sizeof(keytabfile));
-				if (keytabfile[sizeof(keytabfile)-1] != '\0')
-					errx(1, "keytab path name too long");
+				keytabfile = optarg;
 				break;
 			case 'd':
 				strncpy(ccachedir, optarg, sizeof(ccachedir));
diff --git a/utils/gssd/gssd.h b/utils/gssd/gssd.h
index e16b187..4059544 100644
--- a/utils/gssd/gssd.h
+++ b/utils/gssd/gssd.h
@@ -58,8 +58,8 @@
  */
 enum {AUTHTYPE_KRB5, AUTHTYPE_LIPKEY};
 
-extern char			keytabfile[PATH_MAX];
-extern char			*ccachesearch[];
+extern char		       *keytabfile;
+extern char		       *ccachesearch[];
 extern int			use_memcache;
 extern int			root_uses_machine_creds;
 extern unsigned int 		context_timeout;

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux