Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: fix home directory expansion with NIS
- X-seq: zsh-workers 24048
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Zsh workers <zsh-workers@xxxxxxxxxx>
- Subject: PATCH: fix home directory expansion with NIS
- Date: Thu, 01 Nov 2007 10:40:49 +0000
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws;  s=s1024; d=yahoo.co.uk;  h=Received:X-YMail-OSG:Received:From:To:Subject:Date:Message-ID;  b=pnhNVeRH7LNpkvst6Uk6RPfJo0fP2AD0FajMLA9ccEX90yf1msV53cb6bYd5NUpOU5kklsdD2xLHlka5IJFN+MuMu0fnV9X7bxYO7P6OA/wN3nlkBXDHfoHFxyRJO4m+bvrDj5A/pZZYaYI5tCZBZgPKOMR+RpZBkUsEq1pExJc=  ;
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
This has been irritating me for a while: some ~username expansions were
coming out as garbled strings from the middle of the password file.
The problem, which is specific to NIS on Solaris, occurs because our
yp_all callback was assuming that the key and val parameters are null
terminated. The fix below makes use of the vallen parameter to find the
end of the string.
Oliver
--- hashtable.c.orig	Thu Nov  1 10:59:22 2007
+++ hashtable.c	Thu Nov  1 11:00:34 2007
@@ -1258,7 +1258,8 @@
 
     if (vallen > keylen && *(p = val + keylen) == ':') {
 	*p++ = '\0';
-	if ((de = strrchr(p, ':'))) {
+	for (de = val + vallen - 1; *de != ':' && de > val; de--);
+	if (de > val) {
 	    *de = '\0';
 	    if ((d = strrchr(p, ':'))) {
 		if (*++d && val[0])
Messages sorted by:
Reverse Date,
Date,
Thread,
Author