From 4754959ee71fb812d4e214dfd61923fe2bf28c1f Mon Sep 17 00:00:00 2001 From: Frederic Marchal Date: Fri, 4 Jan 2013 19:47:16 +0100 Subject: [PATCH] Mangled file name is really unique Due to an error, the file name created by mangling the user ID was not using the suffix that was supposed to make it unique. Therefore, user's names made of several consecutive non alphanumeric characters were not unique. The error manifested itself as an error message saying that the _.user_unsort file could not be sorted. It occurred after the first user assigned to the _ file name had been sorted and its file deleted. Therefore any subsequent user sharing the _ file name would fail. This patch also makes sure no original user name might possibly ends up being the same as a mangled name. --- userinfo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/userinfo.c b/userinfo.c index a92ea93..25e05f3 100644 --- a/userinfo.c +++ b/userinfo.c @@ -125,15 +125,15 @@ struct userinfostruct *userinfo_create(const char *userid) } } if (j==0) filename[j++]='_'; //don't leave a file name empty + flen=j; filename[j]='\0'; - flen=i-1; count=0; for (group=first_user_group ; group ; group=group->next) { lastuser=(group->next) ? group->nusers : group->nusers-1; for (i=0 ; ilist[i].filename)==0) { - clen=sprintf(cstr,"-%04X",count++); + clen=sprintf(cstr,"+%X",count++); if (flen+clen