bug in port:socket-service-port
"Walter C. Pelissero" <[email protected]>
| Newsgroups | gmane.lisp.clocc.devel |
|---|---|
| Message-ID | <[email protected]> |
It seems that socket-service-port would contain a bug in the parsing
of the /etc/services file. It's an error to assume that '/' (slash)
will never occur in the port name; in fact it does occur in the
standard FreeBSD services file.
Please see patch below.
cd /usr/home/wcp/lisp/clocc/src/port/
diff -c /usr/home/wcp/lisp/clocc/src/port/net.lisp.\~1.46.\~ /usr/home/wcp/lisp/clocc/src/port/net.lisp
*** /usr/home/wcp/lisp/clocc/src/port/net.lisp.~1.46.~ Fri Oct 25 14:40:44 2002
--- /usr/home/wcp/lisp/clocc/src/port/net.lisp Mon Jan 20 22:00:59 2003
***************
*** 489,502 ****
"Return the SERVENT structure corresponding to the SERVICE.
When SERVICE is NIL, return the list of all services."
(flet ((parse (str)
! (let ((tok (string-tokens
! (nsubstitute
! #\Space #\/ (subseq str 0 (or (position #\# str)
! (length str)))))))
(values (string-downcase (string (first tok)))
(mapcar (compose string-downcase string) (cdddr tok))
! (second tok)
! (string-downcase (string (third tok))))))
(mkse (na al po pr)
(make-servent :name na :aliases al :port po :proto pr)))
(with-open-file (fl #+unix "/etc/services" #+(or win32 mswindows)
--- 489,501 ----
"Return the SERVENT structure corresponding to the SERVICE.
When SERVICE is NIL, return the list of all services."
(flet ((parse (str)
! (let* ((tok (string-tokens
! (subseq str 0 (or (position #\# str) (length str)))))
! (port/proto (string-tokens (nsubstitute #\Space #\/ (symbol-name (second tok))))))
(values (string-downcase (string (first tok)))
(mapcar (compose string-downcase string) (cdddr tok))
! (first port/proto)
! (string-downcase (string (second port/proto))))))
(mkse (na al po pr)
(make-servent :name na :aliases al :port po :proto pr)))
(with-open-file (fl #+unix "/etc/services" #+(or win32 mswindows)
Diff finished at Mon Jan 20 22:02:12
--
walter pelissero
http://www.pelissero.org
-------------------------------------------------------
This SF.NET email is sponsored by: FREE SSL Guide from Thawte
are you planning your Web Server Security? Click here to get a FREE
Thawte SSL guide and find the answers to all your SSL security issues.
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0026en