Commit 493d59cf2622ad10fafd23777f5a4ca776ecef63
1 parent
c027acc9
Exists in
master
and in
3 other branches
set UserName from DDUSER env var - for generate_param_info
Showing
1 changed file
with
10 additions
and
4 deletions
Show diff stats
src/DDClientLibCpp/DD_client.cc
@@ -292,10 +292,10 @@ int DD_Client::DD_SetVariable(char *InstrName) | @@ -292,10 +292,10 @@ int DD_Client::DD_SetVariable(char *InstrName) | ||
292 | int Request = OPENINSREQ; | 292 | int Request = OPENINSREQ; |
293 | int hostlen,userlen; | 293 | int hostlen,userlen; |
294 | char *PUserHost = UserHost, *PUserName = UserName; | 294 | char *PUserHost = UserHost, *PUserName = UserName; |
295 | + char *pDDuser; | ||
296 | + | ||
295 | /* We need this because XDR works with adresses of pointers */ | 297 | /* We need this because XDR works with adresses of pointers */ |
296 | -#ifdef LOG4CXX | ||
297 | - LOG4CXX_DEBUG(_logger, "DD_Client::DD_SetVariable - UserName is undefined"); | ||
298 | -#endif | 298 | + |
299 | /* If there is no connection, try to get it */ | 299 | /* If there is no connection, try to get it */ |
300 | if(SocketID < 0) | 300 | if(SocketID < 0) |
301 | if((SocketID = GetSocket()) < 0) | 301 | if((SocketID = GetSocket()) < 0) |
@@ -331,10 +331,16 @@ int DD_Client::DD_SetVariable(char *InstrName) | @@ -331,10 +331,16 @@ int DD_Client::DD_SetVariable(char *InstrName) | ||
331 | 331 | ||
332 | /*-------- preparation an authorization request ----------------*/ | 332 | /*-------- preparation an authorization request ----------------*/ |
333 | if(UserName[0] == '\0') { | 333 | if(UserName[0] == '\0') { |
334 | - strcpy(UserName,NONAME); | 334 | + |
335 | + pDDuser = getenv ("DDUSER"); | ||
336 | + | ||
337 | + if (pDDuser != NULL) strcpy(UserName, pDDuser); | ||
338 | + else { | ||
339 | + strcpy(UserName,NONAME); | ||
335 | #ifdef LOG4CXX | 340 | #ifdef LOG4CXX |
336 | LOG4CXX_ERROR(_logger, "DD_Client::DD_SetVariable - UserName is undefined"); | 341 | LOG4CXX_ERROR(_logger, "DD_Client::DD_SetVariable - UserName is undefined"); |
337 | #endif | 342 | #endif |
343 | + } | ||
338 | } | 344 | } |
339 | hostlen = strlen(UserHost); | 345 | hostlen = strlen(UserHost); |
340 | userlen = strlen(UserName); | 346 | userlen = strlen(UserName); |