diff --git a/src/DDClientLibCpp/DD_client.cc b/src/DDClientLibCpp/DD_client.cc index 24363ae..651d424 100644 --- a/src/DDClientLibCpp/DD_client.cc +++ b/src/DDClientLibCpp/DD_client.cc @@ -292,10 +292,10 @@ int DD_Client::DD_SetVariable(char *InstrName) int Request = OPENINSREQ; int hostlen,userlen; char *PUserHost = UserHost, *PUserName = UserName; + char *pDDuser; + /* We need this because XDR works with adresses of pointers */ -#ifdef LOG4CXX - LOG4CXX_DEBUG(_logger, "DD_Client::DD_SetVariable - UserName is undefined"); -#endif + /* If there is no connection, try to get it */ if(SocketID < 0) if((SocketID = GetSocket()) < 0) @@ -331,10 +331,16 @@ int DD_Client::DD_SetVariable(char *InstrName) /*-------- preparation an authorization request ----------------*/ if(UserName[0] == '\0') { - strcpy(UserName,NONAME); + + pDDuser = getenv ("DDUSER"); + + if (pDDuser != NULL) strcpy(UserName, pDDuser); + else { + strcpy(UserName,NONAME); #ifdef LOG4CXX LOG4CXX_ERROR(_logger, "DD_Client::DD_SetVariable - UserName is undefined"); #endif + } } hostlen = strlen(UserHost); userlen = strlen(UserName); -- libgit2 0.21.2