From: Frederic Marchal Date: Fri, 4 Jan 2013 18:47:16 +0000 (+0100) Subject: Mangled file name is really unique X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4754959ee71fb812d4e214dfd61923fe2bf28c1f;p=thirdparty%2Fsarg.git 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. --- 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