Patch

George Lindholm George.Lindholm at ubc.ca
Fri Aug 20 16:54:37 UTC 1999


Reduce the clutter in news.notice a bit

   George
-- 
George.Lindholm at ubc.ca       ITServices, UBC
Programmer/Analyst

phone:    604.822.4375       fax:      604.822.5116

-- Attached file included as plaintext by Listar --
-- File: pa

*** nnrpd/perm.c	1999/08/19 21:38:28	1.1
--- nnrpd/perm.c	1999/08/19 21:45:01
***************
*** 1194,1200 ****
      } else if (WIFEXITED(status)) {
  	if (WEXITSTATUS(status) != 0) {
  	    ubuf[0] = '\0';
! 	    syslog(L_NOTICE, "%s bad_hook program died with status %d",
  	      ClientHost, WEXITSTATUS(status));
  	}
      } else {
--- 1194,1200 ----
      } else if (WIFEXITED(status)) {
  	if (WEXITSTATUS(status) != 0) {
  	    ubuf[0] = '\0';
! 	    syslog(L_TRACE, "%s bad_hook program exited with status %d",
  	      ClientHost, WEXITSTATUS(status));
  	}
      } else {
*** authprogs/ident.c	1999/08/19 20:45:11	1.1
--- authprogs/ident.c	1999/08/19 21:35:21
***************
*** 42,48 ****
  		/* not entirely numeric */
  		if ((s = getservbyname(optarg, "tcp")) == (struct servent *) 0) {
  		    fprintf(stderr, "ident: can't getservbyname(%s/tcp)\n", optarg);
! 		    return(1);
  		}
  		sin.sin_port = s->s_port;
  	    } else
--- 42,48 ----
  		/* not entirely numeric */
  		if ((s = getservbyname(optarg, "tcp")) == (struct servent *) 0) {
  		    fprintf(stderr, "ident: can't getservbyname(%s/tcp)\n", optarg);
! 		    exit(1);
  		}
  		sin.sin_port = s->s_port;
  	    } else
***************
*** 84,108 ****
  
      if (!gotcliaddr || !gotcliport || !gotlocaddr || !gotlocport) {
  	fprintf(stderr, "ident: didn't get ident parameter\n");
! 	return(1);
      }
      /* got all the client parameters, create our local socket. */
      if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
  	fprintf(stderr, "ident: couldn't create socket: %s\n", strerror(errno));
! 	return(1);
      }
      opt = loc.sin_port;
      loc.sin_port = 0;
      if (bind(sock, (struct sockaddr*) &loc, sizeof(loc)) < 0) {
  	fprintf(stderr, "ident: couldn't bind socket: %s\n", strerror(errno));
! 	return(1);
      }
      loc.sin_port = opt;
      sin.sin_addr.s_addr = cli.sin_addr.s_addr;
      if (connect(sock, (struct sockaddr*) &sin, sizeof(sin)) < 0) {
  	fprintf(stderr, "ident: couldn't connect to %s:%d: %s\n",
  	  inet_ntoa(sin.sin_addr), ntohs(sin.sin_port), strerror(errno));
! 	return(1);
      }
  
      /* send the request out */
--- 84,110 ----
  
      if (!gotcliaddr || !gotcliport || !gotlocaddr || !gotlocport) {
  	fprintf(stderr, "ident: didn't get ident parameter\n");
! 	exit(1);
      }
      /* got all the client parameters, create our local socket. */
      if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
  	fprintf(stderr, "ident: couldn't create socket: %s\n", strerror(errno));
! 	exit(1);
      }
      opt = loc.sin_port;
      loc.sin_port = 0;
      if (bind(sock, (struct sockaddr*) &loc, sizeof(loc)) < 0) {
  	fprintf(stderr, "ident: couldn't bind socket: %s\n", strerror(errno));
! 	exit(1);
      }
      loc.sin_port = opt;
      sin.sin_addr.s_addr = cli.sin_addr.s_addr;
      if (connect(sock, (struct sockaddr*) &sin, sizeof(sin)) < 0) {
+       if (errno != ECONNREFUSED) {
  	fprintf(stderr, "ident: couldn't connect to %s:%d: %s\n",
  	  inet_ntoa(sin.sin_addr), ntohs(sin.sin_port), strerror(errno));
!       }
!       exit(1);
      }
  
      /* send the request out */
***************
*** 111,119 ****
      while (got != strlen(buf)) {
  	opt = write(sock, buf+got, strlen(buf)-got);
  	if (opt < 0)
! 	    return(1);
  	else if (!opt)
! 	    return(1);
  	got += opt;
      }
  
--- 113,121 ----
      while (got != strlen(buf)) {
  	opt = write(sock, buf+got, strlen(buf)-got);
  	if (opt < 0)
! 	    exit(1);
  	else if (!opt)
! 	    exit(1);
  	got += opt;
      }
  
***************
*** 122,130 ****
      do {
  	opt = read(sock, buf+got, sizeof(buf)-got);
  	if (opt < 0)
! 	    return(1);
  	else if (!opt)
! 	    return(1);
  	while (opt--)
  	    if (buf[got] != '\n')
  		got++;
--- 124,132 ----
      do {
  	opt = read(sock, buf+got, sizeof(buf)-got);
  	if (opt < 0)
! 	    exit(1);
  	else if (!opt)
! 	    exit(1);
  	while (opt--)
  	    if (buf[got] != '\n')
  		got++;
***************
*** 136,142 ****
      /* buf now contains the entire ident response. */
      if (!(iter = strchr(buf, ':')))
  	/* malformed response */
! 	return(1);
      iter++;
  
      while (*iter && ISWHITE(*iter))
--- 138,144 ----
      /* buf now contains the entire ident response. */
      if (!(iter = strchr(buf, ':')))
  	/* malformed response */
! 	exit(1);
      iter++;
  
      while (*iter && ISWHITE(*iter))
***************
*** 146,152 ****
  	endstr++;
      if (!*endstr)
  	/* malformed response */
! 	return(1);
      if (*endstr != ':') {
  	*endstr++ = '\0';
  	while (*endstr != ':')
--- 148,154 ----
  	endstr++;
      if (!*endstr)
  	/* malformed response */
! 	exit(1);
      if (*endstr != ':') {
  	*endstr++ = '\0';
  	while (*endstr != ':')
***************
*** 156,169 ****
      *endstr = '\0';
  
      if (!strcmp(iter, "ERROR"))
! 	return(1);
      else if (strcmp(iter, "USERID") != 0)
  	/* malformed response */
! 	return(1);
  
      /* skip the operating system */
      if (!(iter = strchr(endstr+1, ':')))
! 	return(1);
  
      /* everything else is username */
      iter++;
--- 158,171 ----
      *endstr = '\0';
  
      if (!strcmp(iter, "ERROR"))
! 	exit(1);
      else if (strcmp(iter, "USERID") != 0)
  	/* malformed response */
! 	exit(1);
  
      /* skip the operating system */
      if (!(iter = strchr(endstr+1, ':')))
! 	exit(1);
  
      /* everything else is username */
      iter++;
***************
*** 171,178 ****
  	iter++;
      if (!*iter || *iter == '[')
  	/* null, or encrypted response */
! 	return(1);
      printf("User:%s\n", iter);
  
!     return(0);
  }
--- 173,180 ----
  	iter++;
      if (!*iter || *iter == '[')
  	/* null, or encrypted response */
! 	exit(1);
      printf("User:%s\n", iter);
  
!     exit(0);
  }




More information about the inn-patches mailing list