~mdw
/
become
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Allow default port to be given as a service name or port number.
[become]
/
src
/
parser.y
diff --git
a/src/parser.y
b/src/parser.y
index
688ffc4
..
b36ecdb
100644
(file)
--- a/
src/parser.y
+++ b/
src/parser.y
@@
-1,6
+1,6
@@
/* -*-c-*-
*
/* -*-c-*-
*
- * $Id: parser.y,v 1.
2 1997/08/04 10:24:24
mdw Exp $
+ * $Id: parser.y,v 1.
3 1997/09/09 18:17:06
mdw Exp $
*
* Parser for `become.conf' files
*
*
* Parser for `become.conf' files
*
@@
-29,6
+29,9
@@
/*----- Revision history --------------------------------------------------*
*
* $Log: parser.y,v $
/*----- Revision history --------------------------------------------------*
*
* $Log: parser.y,v $
+ * Revision 1.3 1997/09/09 18:17:06 mdw
+ * Allow default port to be given as a service name or port number.
+ *
* Revision 1.2 1997/08/04 10:24:24 mdw
* Sources placed under CVS control.
*
* Revision 1.2 1997/08/04 10:24:24 mdw
* Sources placed under CVS control.
*
@@
-49,7
+52,13
@@
/* --- Unix headers --- */
#include <sys/types.h>
/* --- Unix headers --- */
#include <sys/types.h>
+#include <sys/socket.h>
+
+#include <netinet/in.h>
+
+#include <arpa/inet.h>
+#include <netdb.h>
#include <pwd.h>
#include <unistd.h>
#include <pwd.h>
#include <unistd.h>
@@
-190,7
+199,16
@@
host_spec : HOST name '=' host_class ';' {
}
;
}
;
-port_spec : PORT INT ';' { daemon_usePort($2); }
+port_spec : PORT STRING ';' {
+ struct servent *s = getservbyname($2, "udp");
+ if (!s) {
+ moan("unknown service `%s' at line %i",
+ $2, lex_line);
+ YYERROR;
+ }
+ daemon_usePort(s->s_port);
+ }
+ | PORT INT ';' { daemon_usePort(htons($2)); }
;
key_spec : KEYFILE STRING ';' { daemon_readKey($2); }
;
key_spec : KEYFILE STRING ';' { daemon_readKey($2); }