chiark / gitweb /
Allow control of when the LD_PRELOAD is passed on.
[authbind.git] / helper.c
index 5bd95fd24dbc8ed66d6826508cf02ed4f9f45a3d..409ed7bc2744c95abdac8b0aeaaf77e506fc0177 100644 (file)
--- a/helper.c
+++ b/helper.c
@@ -48,7 +48,7 @@ static void perrorfail(const char *m) {
 }
 
 static void badusage(void) {
-  fprintf(stderr,"libauthbind's helper: bad usage\n %s\n",rcsid);
+  fprintf(stderr,"libauthbind's helper: bad usage\n (%s)\n",rcsid);
   exit(ENOSYS);
 }
 
@@ -72,6 +72,7 @@ int main(int argc, const char *const *argv) {
   if (argc != 3) badusage(); 
   addr= strtoul(argv[1],&ep,16); if (*ep || addr&~0x0ffffffffUL) badusage();
   port= strtoul(argv[2],&ep,16); if (*ep || port&~0x0ffffUL) badusage();
+  if (port >= IPPORT_RESERVED/2) _exit(EPERM);
 
   if (chdir(CONFIGDIR)) perrorfail("chdir " CONFIGDIR);