Commit 493d59cf2622ad10fafd23777f5a4ca776ecef63

Authored by Elena.Budnik
1 parent c027acc9

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 292 int Request = OPENINSREQ;
293 293 int hostlen,userlen;
294 294 char *PUserHost = UserHost, *PUserName = UserName;
  295 + char *pDDuser;
  296 +
295 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 299 /* If there is no connection, try to get it */
300 300 if(SocketID < 0)
301 301 if((SocketID = GetSocket()) < 0)
... ... @@ -331,10 +331,16 @@ int DD_Client::DD_SetVariable(char *InstrName)
331 331  
332 332 /*-------- preparation an authorization request ----------------*/
333 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 340 #ifdef LOG4CXX
336 341 LOG4CXX_ERROR(_logger, "DD_Client::DD_SetVariable - UserName is undefined");
337 342 #endif
  343 + }
338 344 }
339 345 hostlen = strlen(UserHost);
340 346 userlen = strlen(UserName);
... ...