[nio-cvs] r113 - branches/home/psmith/restructure/src/io

psmith at common-lisp.net psmith at common-lisp.net
Thu Apr 26 22:33:50 UTC 2007


Author: psmith
Date: Thu Apr 26 18:33:49 2007
New Revision: 113

Modified:
   branches/home/psmith/restructure/src/io/ip-authorisation.lisp
   branches/home/psmith/restructure/src/io/nio-package.lisp
Log:
Added allow-ips to ip-authorisation

Modified: branches/home/psmith/restructure/src/io/ip-authorisation.lisp
==============================================================================
--- branches/home/psmith/restructure/src/io/ip-authorisation.lisp	(original)
+++ branches/home/psmith/restructure/src/io/ip-authorisation.lisp	Thu Apr 26 18:33:49 2007
@@ -35,8 +35,18 @@
     (setf +ip-list+ (read stream)))
   (format t "Loaded allowed ips:~A~% " +ip-list+))
 
+;(allow-ips '("127.0.0.1"))
+(defun allow-ips (ip-list)
+  "Add each ip in the allow ips list to our list"
+  (dolist (item ip-list)
+    (when (not (check-ip-str item)) (push item +ip-list+))))
+
+
+(defun check-ip-str(ip-string)
+  (member ip-string +ip-list+ :test 'string-equal))
+
 (defun check-ip (async-fd)
   (with-slots (remote-host) (socket async-fd)
     (let ((str-rep (format nil "~{~a~^.~}" (reverse remote-host))))
       (format t "ip-authorisation:check-ip ~A ~A~%" str-rep +ip-list+)
-      (member str-rep +ip-list+ :test 'string-equal))))
\ No newline at end of file
+      (check-ip-str str-rep))))

Modified: branches/home/psmith/restructure/src/io/nio-package.lisp
==============================================================================
--- branches/home/psmith/restructure/src/io/nio-package.lisp	(original)
+++ branches/home/psmith/restructure/src/io/nio-package.lisp	Thu Apr 26 18:33:49 2007
@@ -41,7 +41,7 @@
 	     packet write-bytes get-packet-size
 
 	     ;;ip-authorisation
-	     check-ip load-ips
+	     check-ip load-ips allow-ips
 	     
 	     ;;nodes
 	     node with-connected-nodes active-conn node-from-socket-repn remote-host remote-port



More information about the Nio-cvs mailing list