~mdw
/
become
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6a4ec25
)
Allow default port to be given as a service name or port number.
author
mdw
<mdw>
Tue, 9 Sep 1997 18:17:06 +0000
(18:17 +0000)
committer
mdw
<mdw>
Tue, 9 Sep 1997 18:17:06 +0000
(18:17 +0000)
src/daemon.c
patch
|
blob
|
blame
|
history
src/parser.y
patch
|
blob
|
blame
|
history
diff --git
a/src/daemon.c
b/src/daemon.c
index
5b5df85
..
f79d76b
100644
(file)
--- a/
src/daemon.c
+++ b/
src/daemon.c
@@
-1,6
+1,6
@@
/* -*-c-*-
*
/* -*-c-*-
*
- * $Id: daemon.c,v 1.
5 1997/08/20 16:17:10
mdw Exp $
+ * $Id: daemon.c,v 1.
6 1997/09/09 18:17:06
mdw Exp $
*
* Running a `become' daemon
*
*
* Running a `become' daemon
*
@@
-29,7
+29,10
@@
/*----- Revision history --------------------------------------------------*
*
* $Log: daemon.c,v $
/*----- Revision history --------------------------------------------------*
*
* $Log: daemon.c,v $
- * Revision 1.5 1997/08/20 16:17:10 mdw
+ * Revision 1.6 1997/09/09 18:17:06 mdw
+ * Allow default port to be given as a service name or port number.
+ *
+ * Revision 1.5 1997/08/20 16:17:10 mdw
* More sensible restart routine: `_reinit' functions replaced by `_end' and
* `_init' functions.
*
* More sensible restart routine: `_reinit' functions replaced by `_end' and
* `_init' functions.
*
@@
-323,7
+326,7
@@
void daemon_init(const char *cf, int port)
struct servent *se = getservbyname(quis(), "udp");
if (!se)
die("no idea which port to use");
struct servent *se = getservbyname(quis(), "udp");
if (!se)
die("no idea which port to use");
- daemon__port =
ntohs(se->s_port)
;
+ daemon__port =
se->s_port
;
}
/* --- Now set up a socket --- */
}
/* --- Now set up a socket --- */
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); }