View | Details | Raw Unified | Return to bug 80732 | Differences between
and this patch

Collapse All | Expand All

(-)/usr/src/contrib/telnet/telnetd/telnetd.c (-6 / +25 lines)
Lines 740-745 Link Here
740
	char *HE;
740
	char *HE;
741
	char *HN;
741
	char *HN;
742
	char *IM;
742
	char *IM;
743
	char *IF;
743
	int nfd;
744
	int nfd;
744
745
745
	/*
746
	/*
Lines 900-917 Link Here
900
	 */
901
	 */
901
902
902
	if (getent(defent, "default") == 1) {
903
	if (getent(defent, "default") == 1) {
903
		char *cp=defstrs;
904
		char *cp = defstrs;
904
905
905
		HE = Getstr("he", &cp);
906
		HE = Getstr("he", &cp);
906
		HN = Getstr("hn", &cp);
907
		HN = Getstr("hn", &cp);
907
		IM = Getstr("im", &cp);
908
		IF = Getstr("if", &cp);
908
		if (HN && *HN)
909
		if (HN != NULL && *HN != 0)
909
			(void) strlcpy(host_name, HN, sizeof(host_name));
910
			(void) strlcpy(host_name, HN, sizeof(host_name));
910
		if (IM == 0)
911
		if (IF != NULL) {
911
			IM = strdup("");
912
			int if_fd;
913
914
			if ((if_fd = open(IF, O_RDONLY)) != -1) {
915
				struct stat if_fst;
916
917
				fstat(if_fd, &if_fst);
918
				IM = malloc(if_fst.st_size + 1);
919
				read(if_fd, IM, if_fst.st_size);
920
				IM[if_fst.st_size] = 0;
921
				close(if_fd);
922
			} else {
923
				IF = NULL;
924
			}
925
		}
926
		if (IF == NULL) {
927
			IM = Getstr("im", &cp);
928
			if (IM == NULL)
929
				IM = strdup("");
930
		}
912
	} else {
931
	} else {
913
		IM = strdup(DEFAULT_IM);
932
		IM = strdup(DEFAULT_IM);
914
		HE = 0;
933
		HE = NULL;
915
	}
934
	}
916
	edithost(HE, host_name);
935
	edithost(HE, host_name);
917
	if (hostinfo && *IM)
936
	if (hostinfo && *IM)

Return to bug 80732