]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/lib/edit.c
update version
[bacula/bacula] / bacula / src / lib / edit.c
index d77d8bfaff4ae944926962c7bfc902a117e4cbcf..dd7cb9002a3e172852f0d1db0d2e63f1b504747a 100644 (file)
@@ -1,7 +1,7 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2002-2009 Free Software Foundation Europe e.V.
+   Copyright (C) 2002-2011 Free Software Foundation Europe e.V.
 
    The main author of Bacula is Kern Sibbald, with contributions from
    many others, a complete list can be found in the file AUTHORS.
@@ -30,7 +30,6 @@
  *
  *    Kern Sibbald, December MMII
  *
- *   Version $Id$
  */
 
 #include "bacula.h"
@@ -466,13 +465,20 @@ bool is_an_integer(const char *n)
  * Check if the Volume name has legal characters
  * If ua is non-NULL send the message
  */
-bool is_name_valid(char *name, POOLMEM **msg)
+bool is_name_valid(const char *name, POOLMEM **msg)
 {
    int len;
-   char *p;
+   const char *p;
    /* Special characters to accept */
    const char *accept = ":.-_ ";
 
+   /* No name is invalid */
+   if (!name) {
+      if (msg) {
+         Mmsg(msg, _("Empty name not allowed.\n"));
+      }
+      return false;
+   }
    /* Restrict the characters permitted in the Volume name */
    for (p=name; *p; p++) {
       if (B_ISALPHA(*p) || B_ISDIGIT(*p) || strchr(accept, (int)(*p))) {
@@ -483,7 +489,7 @@ bool is_name_valid(char *name, POOLMEM **msg)
       }
       return false;
    }
-   len = strlen(name);
+   len = p - name;
    if (len >= MAX_NAME_LENGTH) {
       if (msg) {
          Mmsg(msg, _("Name too long.\n"));