]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
Pull up 1.19
authorTed Lemon <source@isc.org>
Wed, 5 Aug 1998 19:33:16 +0000 (19:33 +0000)
committerTed Lemon <source@isc.org>
Wed, 5 Aug 1998 19:33:16 +0000 (19:33 +0000)
server/db.c

index 327a9355adbadd5b31776ac408e91bc3bc962416..f5a8b6c901334fa246828f484ce29be8dd4a813e 100644 (file)
@@ -42,7 +42,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: db.c,v 1.17 1997/12/02 07:44:56 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: db.c,v 1.17.2.1 1998/08/05 19:33:16 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -61,6 +61,7 @@ int write_lease (lease)
        struct tm *t;
        char tbuf [64];
        int errors = 0;
+       int i;
 
        if (counting)
                ++count;
@@ -134,6 +135,10 @@ int write_lease (lease)
                }
        }
        if (lease -> client_hostname) {
+               for (i = 0; lease -> client_hostname [i]; i++)
+                       if (lease -> client_hostname [i] < 33 ||
+                           lease -> client_hostname [i] > 126)
+                               goto bad_client_hostname;
                errno = 0;
                fprintf (db_file, "\n\tclient-hostname \"%s\";",
                         lease -> client_hostname);
@@ -141,7 +146,13 @@ int write_lease (lease)
                        ++errors;
                }
        }
+       bad_client_hostname:
        if (lease -> hostname) {
+               for (i = 0; lease -> hostname [i]; i++)
+                       if (lease -> hostname [i] < 33 ||
+                           lease -> hostname [i] > 126)
+                               goto bad_hostname;
+               errno = 0;
                errno = 0;
                fprintf (db_file, "\n\thostname \"%s\";",
                         lease -> hostname);
@@ -149,6 +160,7 @@ int write_lease (lease)
                        ++errors;
                }
        }
+       bad_hostname:
        errno = 0;
        fputs ("\n}\n", db_file);
        if (errno) {