FreeBSD Bugzilla – Attachment 7751 Details for
Bug 16619
trimdomain does not handle peer domains
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 1.73 KB, created by
pirzyk
on 2000-02-09 21:50:00 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
pirzyk
Created:
2000-02-09 21:50:00 UTC
Size:
1.73 KB
patch
obsolete
>*** logwtmp.c.orig Wed Feb 9 10:42:22 2000 >--- logwtmp.c Wed Feb 9 12:00:19 2000 >*************** >*** 55,77 **** > #include <utmp.h> > > void >! trimdomain(char *fullhost, int hostsize) > { >- static char domain[MAXHOSTNAMELEN]; >- static int first = 1; >- static size_t dlen; > char *s, *end; > int spn, ok; >! >! if (first) { >! first = 0; >! if (gethostname(domain, sizeof(domain) - 1) == 0 && >! (s = strchr(domain, '.'))) >! memmove(domain, s + 1, strlen(s + 1) + 1); >! else >! domain[0] = '\0'; >! dlen = strlen(domain); >! } > > if (domain[0] != '\0') { > s = fullhost; >--- 55,65 ---- > #include <utmp.h> > > void >! _trimdomain(char *fullhost, int hostsize, char *domain) > { > char *s, *end; > int spn, ok; >! size_t dlen = strlen(domain); > > if (domain[0] != '\0') { > s = fullhost; >*************** >*** 105,110 **** >--- 93,126 ---- > } > } > } >+ >+ void >+ trimdomain(char *fullhost, int hostsize) >+ { >+ static char domain[MAXHOSTNAMELEN]; >+ static int first = 1, dots = 0; >+ int i; >+ size_t len = strlen (fullhost); >+ char *s, *ptr = domain; >+ >+ if (first) { >+ first = 0; >+ if (gethostname(domain, sizeof(domain) - 1) == 0 && >+ (s = strchr(domain, '.'))) { >+ memmove(domain, s + 1, strlen(s + 1) + 1); >+ while ((ptr = strchr(ptr+1, '.'))) dots++; >+ } else { >+ domain[0] = '\0'; >+ } >+ } >+ >+ for (i=0, ptr=domain; i < dots && ptr; i++) { >+ _trimdomain(fullhost, hostsize, ptr); >+ if ( strlen (fullhost) != len ) break; >+ ptr = strchr (ptr, '.')+1; >+ } >+ } >+ > > void > logwtmp(line, name, host)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 16619
: 7751