[augeas-devel] augeas: master - Services: various small fixes to process Fedora's /etc/services
David Lutterkort
lutter at fedoraproject.org
Wed Feb 11 21:43:30 UTC 2009
Gitweb: http://git.fedorahosted.org/git/augeas.git?p=augeas.git;a=commitdiff;h=2e0d946cb1b1a1fd36677faa4706ae4e7ff7b12b
Commit: 2e0d946cb1b1a1fd36677faa4706ae4e7ff7b12b
Parent: adbcf97a45837879b5d0305a9a92c0564473953c
Author: David Lutterkort <lutter at redhat.com>
AuthorDate: Wed Feb 11 13:38:36 2009 -0800
Committer: David Lutterkort <lutter at redhat.com>
CommitterDate: Wed Feb 11 13:41:31 2009 -0800
Services: various small fixes to process Fedora's /etc/services
---
lenses/services.aug | 6 +-
lenses/tests/test_services.aug | 32 ++++-
tests/root/etc/services | 387 ++++++++++++++++++++++++++++++++++++++++
3 files changed, 420 insertions(+), 5 deletions(-)
diff --git a/lenses/services.aug b/lenses/services.aug
index c8c4e8f..3d4799c 100644
--- a/lenses/services.aug
+++ b/lenses/services.aug
@@ -41,12 +41,12 @@ module Services =
(* Group: Generic primitives *)
(* Variable: eol *)
-let eol = Util.eol
+let eol = del /[ \t]*(#)?[ \t]*\n/ "\n"
let indent = Util.indent
let comment = Util.comment
let empty = Util.empty
let protocol_re = /[a-zA-Z]+/
-let word_re = /[a-zA-Z0-9_-]+/
+let word_re = /[a-zA-Z0-9_.+*\/-]+/
let num_re = /[0-9]+/
(* Group: Separators *)
@@ -83,5 +83,3 @@ let lns = ( empty | comment | record )*
let filter = (incl "/etc/services")
let xfm = transform lns filter
-
-
diff --git a/lenses/tests/test_services.aug b/lenses/tests/test_services.aug
index dc01ef5..e563065 100644
--- a/lenses/tests/test_services.aug
+++ b/lenses/tests/test_services.aug
@@ -9,7 +9,8 @@ echo 7/udp
discard 9/tcp sink null
systat 11/tcp users
# another comment
-"
+whois++ 63/tcp
+z39.50 210/tcp z3950 wais # NISO Z39.50 database \n"
test Services.lns get example =
{ "#comment" = "a comment" }
@@ -31,3 +32,32 @@ systat 11/tcp users
{ "protocol" = "tcp" }
{ "alias" = "users" } }
{ "#comment" = "another comment" }
+ { "service-name" = "whois++"
+ { "port" = "63" }
+ { "protocol" = "tcp" } }
+ { "service-name" = "z39.50"
+ { "port" = "210" }
+ { "protocol" = "tcp" }
+ { "alias" = "z3950" }
+ { "alias" = "wais" }
+ { "#comment" = "NISO Z39.50 database" } }
+
+ (* We completely suppress empty comments *)
+ test Services.record get "mtp\t\t1911/tcp\t\t\t#\n" =
+ { "service-name" = "mtp"
+ { "port" = "1911" }
+ { "protocol" = "tcp" } }
+
+ test Services.lns get "sql*net\t\t66/tcp\t\t\t# Oracle SQL*NET\n" =
+ { "service-name" = "sql*net"
+ { "port" = "66" }
+ { "protocol" = "tcp" }
+ { "#comment" = "Oracle SQL*NET" } }
+
+ (* Fake service to check that we allow enoughspecial characters *)
+ test Services.lns get "special.*+-/chars\t0/proto\n" =
+ { "service-name" = "special.*+-/chars"
+ { "port" = "0" }
+ { "protocol" = "proto" } }
+
+
diff --git a/tests/root/etc/services b/tests/root/etc/services
new file mode 100644
index 0000000..0f57519
--- /dev/null
+++ b/tests/root/etc/services
@@ -0,0 +1,387 @@
+# /etc/services:
+# $Id: services,v 1.44 2008/04/07 21:30:33 pknirsch Exp $
+#
+#
+# Truncated version of Fedora's /etc/services, the original is gigantic
+#
+# Network services, Internet style
+#
+# Note that it is presently the policy of IANA to assign a single well-known
+# port number for both TCP and UDP; hence, most entries here have two entries
+# even if the protocol doesn't support UDP operations.
+# Updated from RFC 1700, ``Assigned Numbers'' (October 1994). Not all ports
+# are included, only the more common ones.
+#
+# The latest IANA port assignments can be gotten from
+# http://www.iana.org/assignments/port-numbers
+# The Well Known Ports are those from 0 through 1023.
+# The Registered Ports are those from 1024 through 49151
+# The Dynamic and/or Private Ports are those from 49152 through 65535
+#
+# Each line describes one service, and is of the form:
+#
+# service-name port/protocol [aliases ...] [# comment]
+
+tcpmux 1/tcp # TCP port service multiplexer
+tcpmux 1/udp # TCP port service multiplexer
+rje 5/tcp # Remote Job Entry
+rje 5/udp # Remote Job Entry
+echo 7/tcp
+echo 7/udp
+discard 9/tcp sink null
+discard 9/udp sink null
+systat 11/tcp users
+systat 11/udp users
+daytime 13/tcp
+daytime 13/udp
+qotd 17/tcp quote
+qotd 17/udp quote
+msp 18/tcp # message send protocol
+msp 18/udp # message send protocol
+chargen 19/tcp ttytst source
+chargen 19/udp ttytst source
+ftp-data 20/tcp
+ftp-data 20/udp
+# 21 is registered to ftp, but also used by fsp
+ftp 21/tcp
+ftp 21/udp fsp fspd
+ssh 22/tcp # SSH Remote Login Protocol
+ssh 22/udp # SSH Remote Login Protocol
+telnet 23/tcp
+telnet 23/udp
+# 24 - private mail system
+lmtp 24/tcp # LMTP Mail Delivery
+lmtp 24/udp # LMTP Mail Delivery
+smtp 25/tcp mail
+smtp 25/udp mail
+time 37/tcp timserver
+time 37/udp timserver
+rlp 39/tcp resource # resource location
+rlp 39/udp resource # resource location
+nameserver 42/tcp name # IEN 116
+nameserver 42/udp name # IEN 116
+nicname 43/tcp whois
+nicname 43/udp whois
+tacacs 49/tcp # Login Host Protocol (TACACS)
+tacacs 49/udp # Login Host Protocol (TACACS)
+re-mail-ck 50/tcp # Remote Mail Checking Protocol
+re-mail-ck 50/udp # Remote Mail Checking Protocol
+domain 53/tcp # name-domain server
+domain 53/udp
+whois++ 63/tcp
+whois++ 63/udp
+bootps 67/tcp # BOOTP server
+bootps 67/udp
+bootpc 68/tcp dhcpc # BOOTP client
+bootpc 68/udp dhcpc
+tftp 69/tcp
+tftp 69/udp
+gopher 70/tcp # Internet Gopher
+gopher 70/udp
+netrjs-1 71/tcp # Remote Job Service
+netrjs-1 71/udp # Remote Job Service
+netrjs-2 72/tcp # Remote Job Service
+netrjs-2 72/udp # Remote Job Service
+netrjs-3 73/tcp # Remote Job Service
+netrjs-3 73/udp # Remote Job Service
+netrjs-4 74/tcp # Remote Job Service
+netrjs-4 74/udp # Remote Job Service
+finger 79/tcp
+finger 79/udp
+http 80/tcp www www-http # WorldWideWeb HTTP
+http 80/udp www www-http # HyperText Transfer Protocol
+kerberos 88/tcp kerberos5 krb5 # Kerberos v5
+kerberos 88/udp kerberos5 krb5 # Kerberos v5
+supdup 95/tcp
+supdup 95/udp
+hostname 101/tcp hostnames # usually from sri-nic
+hostname 101/udp hostnames # usually from sri-nic
+iso-tsap 102/tcp tsap # part of ISODE.
+csnet-ns 105/tcp cso # also used by CSO name server
+csnet-ns 105/udp cso
+# unfortunately the poppassd (Eudora) uses a port which has already
+# been assigned to a different service. We list the poppassd as an
+# alias here. This should work for programs asking for this service.
+# (due to a bug in inetd the 3com-tsmux line is disabled)
+#3com-tsmux 106/tcp poppassd
+#3com-tsmux 106/udp poppassd
+rtelnet 107/tcp # Remote Telnet
+rtelnet 107/udp
+pop2 109/tcp pop-2 postoffice # POP version 2
+pop2 109/udp pop-2
+pop3 110/tcp pop-3 # POP version 3
+pop3 110/udp pop-3
+sunrpc 111/tcp portmapper rpcbind # RPC 4.0 portmapper TCP
+sunrpc 111/udp portmapper rpcbind # RPC 4.0 portmapper UDP
+auth 113/tcp authentication tap ident
+auth 113/udp authentication tap ident
+sftp 115/tcp
+sftp 115/udp
+uucp-path 117/tcp
+uucp-path 117/udp
+nntp 119/tcp readnews untp # USENET News Transfer Protocol
+nntp 119/udp readnews untp # USENET News Transfer Protocol
+ntp 123/tcp
+ntp 123/udp # Network Time Protocol
+netbios-ns 137/tcp # NETBIOS Name Service
+netbios-ns 137/udp
+netbios-dgm 138/tcp # NETBIOS Datagram Service
+netbios-dgm 138/udp
+netbios-ssn 139/tcp # NETBIOS session service
+netbios-ssn 139/udp
+imap 143/tcp imap2 # Interim Mail Access Proto v2
+imap 143/udp imap2
+snmp 161/tcp # Simple Net Mgmt Proto
+snmp 161/udp # Simple Net Mgmt Proto
+snmptrap 162/tcp # SNMPTRAP
+snmptrap 162/udp snmp-trap # Traps for SNMP
+cmip-man 163/tcp # ISO mgmt over IP (CMOT)
+cmip-man 163/udp
+cmip-agent 164/tcp
+cmip-agent 164/udp
+mailq 174/tcp # MAILQ
+mailq 174/udp # MAILQ
+xdmcp 177/tcp # X Display Mgr. Control Proto
+xdmcp 177/udp
+nextstep 178/tcp NeXTStep NextStep # NeXTStep window
+nextstep 178/udp NeXTStep NextStep # server
+bgp 179/tcp # Border Gateway Proto.
+bgp 179/udp
+prospero 191/tcp # Cliff Neuman's Prospero
+prospero 191/udp
+irc 194/tcp # Internet Relay Chat
+irc 194/udp
+smux 199/tcp # SNMP Unix Multiplexer
+smux 199/udp
+at-rtmp 201/tcp # AppleTalk routing
+at-rtmp 201/udp
+at-nbp 202/tcp # AppleTalk name binding
+at-nbp 202/udp
+at-echo 204/tcp # AppleTalk echo
+at-echo 204/udp
+at-zis 206/tcp # AppleTalk zone information
+at-zis 206/udp
+qmtp 209/tcp # Quick Mail Transfer Protocol
+qmtp 209/udp # Quick Mail Transfer Protocol
+z39.50 210/tcp z3950 wais # NISO Z39.50 database
+z39.50 210/udp z3950 wais
+ipx 213/tcp # IPX
+ipx 213/udp
+imap3 220/tcp # Interactive Mail Access
+imap3 220/udp # Protocol v3
+link 245/tcp ttylink
+link 245/udp ttylink
+fatserv 347/tcp # Fatmen Server
+fatserv 347/udp # Fatmen Server
+rsvp_tunnel 363/tcp
+rsvp_tunnel 363/udp
+odmr 366/tcp # odmr required by fetchmail
+odmr 366/udp # odmr required by fetchmail
+rpc2portmap 369/tcp
+rpc2portmap 369/udp # Coda portmapper
+codaauth2 370/tcp
+codaauth2 370/udp # Coda authentication server
+ulistproc 372/tcp ulistserv # UNIX Listserv
+ulistproc 372/udp ulistserv
+ldap 389/tcp
+ldap 389/udp
+svrloc 427/tcp # Server Location Protocl
+svrloc 427/udp # Server Location Protocl
+mobileip-agent 434/tcp
+mobileip-agent 434/udp
+mobilip-mn 435/tcp
+mobilip-mn 435/udp
+https 443/tcp # MCom
+https 443/udp # MCom
+snpp 444/tcp # Simple Network Paging Protocol
+snpp 444/udp # Simple Network Paging Protocol
+microsoft-ds 445/tcp
+microsoft-ds 445/udp
+kpasswd 464/tcp kpwd # Kerberos "passwd"
+kpasswd 464/udp kpwd # Kerberos "passwd"
+photuris 468/tcp
+photuris 468/udp
+saft 487/tcp # Simple Asynchronous File Transfer
+saft 487/udp # Simple Asynchronous File Transfer
+gss-http 488/tcp
+gss-http 488/udp
+pim-rp-disc 496/tcp
+pim-rp-disc 496/udp
+isakmp 500/tcp
+isakmp 500/udp
+gdomap 538/tcp # GNUstep distributed objects
+gdomap 538/udp # GNUstep distributed objects
+iiop 535/tcp
+iiop 535/udp
+dhcpv6-client 546/tcp
+dhcpv6-client 546/udp
+dhcpv6-server 547/tcp
+dhcpv6-server 547/udp
+rtsp 554/tcp # Real Time Stream Control Protocol
+rtsp 554/udp # Real Time Stream Control Protocol
+nntps 563/tcp # NNTP over SSL
+nntps 563/udp # NNTP over SSL
+whoami 565/tcp
+whoami 565/udp
+submission 587/tcp msa # mail message submission
+submission 587/udp msa # mail message submission
+npmp-local 610/tcp dqs313_qmaster # npmp-local / DQS
+npmp-local 610/udp dqs313_qmaster # npmp-local / DQS
+npmp-gui 611/tcp dqs313_execd # npmp-gui / DQS
+npmp-gui 611/udp dqs313_execd # npmp-gui / DQS
+hmmp-ind 612/tcp dqs313_intercell # HMMP Indication / DQS
+hmmp-ind 612/udp dqs313_intercell # HMMP Indication / DQS
+ipp 631/tcp # Internet Printing Protocol
+ipp 631/udp # Internet Printing Protocol
+ldaps 636/tcp # LDAP over SSL
+ldaps 636/udp # LDAP over SSL
+acap 674/tcp
+acap 674/udp
+ha-cluster 694/tcp # Heartbeat HA-cluster
+ha-cluster 694/udp # Heartbeat HA-cluster
+kerberos-adm 749/tcp # Kerberos `kadmin' (v5)
+kerberos-adm 749/udp # kerberos administration
+kerberos-iv 750/udp kerberos4 kerberos-sec kdc loadav
+kerberos-iv 750/tcp kerberos4 kerberos-sec kdc rfile
+webster 765/tcp # Network dictionary
+webster 765/udp
+phonebook 767/tcp # Network phonebook
+phonebook 767/udp
+rsync 873/tcp # rsync
+rsync 873/udp # rsync
+rquotad 875/tcp # rquota daemon
+rquotad 875/udp # rquota daemon
+telnets 992/tcp
+telnets 992/udp
+imaps 993/tcp # IMAP over SSL
+imaps 993/udp # IMAP over SSL
+ircs 994/tcp
+ircs 994/udp
+pop3s 995/tcp # POP-3 over SSL
+pop3s 995/udp # POP-3 over SSL
+
+#
+# UNIX specific services
+#
+exec 512/tcp
+biff 512/udp comsat
+login 513/tcp
+who 513/udp whod
+shell 514/tcp cmd # no passwords used
+syslog 514/udp
+printer 515/tcp spooler # line printer spooler
+printer 515/udp spooler # line printer spooler
+talk 517/udp
+ntalk 518/udp
+utime 519/tcp unixtime
+utime 519/udp unixtime
+efs 520/tcp
+router 520/udp route routed # RIP
+ripng 521/tcp
+ripng 521/udp
+timed 525/tcp timeserver
+timed 525/udp timeserver
+tempo 526/tcp newdate
+courier 530/tcp rpc
+conference 531/tcp chat
+netnews 532/tcp
+netwall 533/udp # -for emergency broadcasts
+uucp 540/tcp uucpd # uucp daemon
+klogin 543/tcp # Kerberized `rlogin' (v5)
+kshell 544/tcp krcmd # Kerberized `rsh' (v5)
+afpovertcp 548/tcp # AFP over TCP
+afpovertcp 548/udp # AFP over TCP
+remotefs 556/tcp rfs_server rfs # Brunhoff remote filesystem
+
+#
+# From ``PORT NUMBERS'':
+#
+#>REGISTERED PORT NUMBERS
+#>
+#>The Registered Ports are listed by the IANA and on most systems can be
+#>used by ordinary user processes or programs executed by ordinary
+#>users.
+#>
+#>Ports are used in the TCP [RFC793] to name the ends of logical
+#>connections which carry long term conversations. For the purpose of
+#>providing services to unknown callers, a service contact port is
+#>defined. This list specifies the port used by the server process as
+#>its contact port.
+#>
+#>The IANA registers uses of these ports as a convienence to the
+#>community.
+#
+socks 1080/tcp # socks proxy server
+socks 1080/udp # socks proxy server
+
+# Port 1236 is registered as `bvcontrol', but is also used by the
+# Gracilis Packeten remote config server. The official name is listed as
+# the primary name, with the unregistered name as an alias.
+bvcontrol 1236/tcp rmtcfg # Daniel J. Walsh, Gracilis Packeten remote config server
+bvcontrol 1236/udp # Daniel J. Walsh
+
+h323hostcallsc 1300/tcp # H323 Host Call Secure
+h323hostcallsc 1300/udp # H323 Host Call Secure
+ms-sql-s 1433/tcp # Microsoft-SQL-Server
+ms-sql-s 1433/udp # Microsoft-SQL-Server
+ms-sql-m 1434/tcp # Microsoft-SQL-Monitor
+ms-sql-m 1434/udp # Microsoft-SQL-Monitor
+ica 1494/tcp # Citrix ICA Client
+ica 1494/udp # Citrix ICA Client
+wins 1512/tcp # Microsoft's Windows Internet Name Service
+wins 1512/udp # Microsoft's Windows Internet Name Service
+ingreslock 1524/tcp
+ingreslock 1524/udp
+prospero-np 1525/tcp orasrv # Prospero non-privileged/oracle
+prospero-np 1525/udp orasrv
+datametrics 1645/tcp old-radius sightline # datametrics / old radius entry
+datametrics 1645/udp old-radius sightline # datametrics / old radius entry
+sa-msg-port 1646/tcp old-radacct # sa-msg-port / old radacct entry
+sa-msg-port 1646/udp old-radacct # sa-msg-port / old radacct entry
+kermit 1649/tcp
+kermit 1649/udp
+l2tp 1701/tcp l2f
+l2tp 1701/udp l2f
+h323gatedisc 1718/tcp
+h323gatedisc 1718/udp
+h323gatestat 1719/tcp
+h323gatestat 1719/udp
+h323hostcall 1720/tcp
+h323hostcall 1720/udp
+tftp-mcast 1758/tcp
+tftp-mcast 1758/udp
+mtftp 1759/udp spss-lm
+hello 1789/tcp
+hello 1789/udp
+radius 1812/tcp # Radius
+radius 1812/udp # Radius
+radius-acct 1813/tcp radacct # Radius Accounting
+radius-acct 1813/udp radacct # Radius Accounting
+mtp 1911/tcp #
+mtp 1911/udp #
+hsrp 1985/tcp # Cisco Hot Standby Router Protocol
+hsrp 1985/udp # Cisco Hot Standby Router Protocol
+licensedaemon 1986/tcp
+licensedaemon 1986/udp
+gdp-port 1997/tcp # Cisco Gateway Discovery Protocol
+gdp-port 1997/udp # Cisco Gateway Discovery Protocol
+sieve 2000/tcp cisco-sccp # Sieve Mail Filter Daemon
+sieve 2000/udp cisco-sccp # Sieve Mail Filter Daemon
+nfs 2049/tcp nfsd shilp
+nfs 2049/udp nfsd shilp
+zephyr-srv 2102/tcp # Zephyr server
+zephyr-srv 2102/udp # Zephyr server
+zephyr-clt 2103/tcp # Zephyr serv-hm connection
+zephyr-clt 2103/udp # Zephyr serv-hm connection
+zephyr-hm 2104/tcp # Zephyr hostmanager
+zephyr-hm 2104/udp # Zephyr hostmanager
+cvspserver 2401/tcp # CVS client/server operations
+cvspserver 2401/udp # CVS client/server operations
+venus 2430/tcp # codacon port
+venus 2430/udp # Venus callback/wbc interface
+venus-se 2431/tcp # tcp side effects
+venus-se 2431/udp # udp sftp side effect
+codasrv 2432/tcp # not used
+codasrv 2432/udp # server port
+codasrv-se 2433/tcp # tcp side effects
+codasrv-se 2433/udp # udp sftp side effectQ
More information about the augeas-devel
mailing list