Re: Application name patch - v3
От | Dave Page |
---|---|
Тема | Re: Application name patch - v3 |
Дата | |
Msg-id | 937d27e10911260554lbe616e2xabff5c88aa658a30@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Application name patch - v3 (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: Application name patch - v3
|
Список | pgsql-hackers |
On Wed, Nov 25, 2009 at 10:01 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote: > ISTM restricting the name to ASCII-only is the most reasonable tradeoff. > Of course, as a speaker of English I may be a bit biased here --- but > doing nothing about the issue doesn't seem acceptable. OK - something like this? Should keep non-printable/control characters out of logs too... static const char * assign_application_name(const char *newval, bool doit, GucSource source) { /* Only allow clean ASCII chars in the application name */ int x; char *repval = guc_malloc(ERROR, strlen(newval) + 1); repval[0] = 0; for (x=0; x<strlen(newval); x++) { if (newval[x] < 32 || newval[x] > 126) repval[x] = '?'; else repval[x] = newval[x]; } repval[x+1] = 0; return repval; } -- Dave Page EnterpriseDB UK: http://www.enterprisedb.com
В списке pgsql-hackers по дате отправления: