[prev in list] [next in list] [prev in thread] [next in thread]
List: ipcop-cvs
Subject: [IPCop-cvs] CVS: ipcop/config/cfgroot header.pl,1.7.2.18,1.7.2.19
From: Mark Wormgoor <riddles () users ! sourceforge ! net>
Date: 2002-08-23 7:16:31
[Download RAW message or body]
Update of /cvsroot/ipcop/ipcop/config/cfgroot
In directory usw-pr-cvs1:/tmp/cvs-serv24723/config/cfgroot
Modified Files:
Tag: IPCOP_v0_1
header.pl
Log Message:
- Added validfqdn() function to /var/ipcop/header.pl (by me)
- Added check to time.cgi to either accept valid hostname or valid IP
address (by Eric Oberlander)
Index: header.pl
===================================================================
RCS file: /cvsroot/ipcop/ipcop/config/cfgroot/header.pl,v
retrieving revision 1.7.2.18
retrieving revision 1.7.2.19
diff -C2 -d -r1.7.2.18 -r1.7.2.19
*** header.pl 31 Jul 2002 19:17:24 -0000 1.7.2.18
--- header.pl 23 Aug 2002 07:16:29 -0000 1.7.2.19
***************
*** 7,10 ****
--- 7,11 ----
# Copyright (C) 2002 Bob Grant <bob@cache.ucr.edu> - validmac()
# Copyright (c) 2002/04/13 Steve Bootes - add alias section, helper functions
+ # Copyright (c) 2002/08/23 Mark Wormgoor <mark@wormgoor.com> validfqdn()
#
# $Id$
***************
*** 670,671 ****
--- 671,698 ----
return 1;
}
+
+ sub validfqdn
+ {
+ # Checks a fully qualified domain name against RFC1035
+ my $fqdn = $_[0];
+ my @parts = split (/\./, $fqdn); # Split hostname at the '.'
+ if (scalar(@parts) < 2) { # At least two parts should
+ return 0;} # exist in a FQDN
+ # (i.e. hostname.domain)
+ foreach $part (@parts) {
+ # Each part should be at least two characters in length
+ if (length ($part) < 2) {
+ return 0;}
+ # Only valid characters are a-z, A-Z, 0-9 and -
+ if ($part !~ /^[a-zA-Z0-9-]*$/) {
+ return 0;}
+ # First character can only be a letter
+ if (substr ($part, 0, 1) !~ /^[a-zA-Z]*$/) {
+ return 0;}
+ # Last character can only be a letter or a digit
+ if (substr ($part, -1, 1) !~ /^[a-zA-Z0-9]*$/) {
+ return 0;}
+ }
+ return 1;
+ }
+
-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone? Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
_______________________________________________
IPCop-cvs mailing list
IPCop-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipcop-cvs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic