(file) Return to Executor.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

Diff for /pegasus/src/Pegasus/Common/Executor.cpp between version 1.12 and 1.12.4.3

version 1.12, 2007/08/10 21:30:25 version 1.12.4.3, 2008/02/08 19:42:37
Line 172 
Line 172 
         switch (mode)         switch (mode)
         {         {
             case 'r':             case 'r':
                 return fopen(path, "rb");                  return fopen(path, "r");
  
             case 'w':             case 'w':
                 return fopen(path, "wb");                  return fopen(path, "w");
  
             case 'a':             case 'a':
                 return fopen(path, "a+");                 return fopen(path, "a+");
Line 250 
Line 250 
  
         char cmdLine[2048];         char cmdLine[2048];
  
         sprintf(cmdLine, "\"%s\" %s %s \"%s\"",          sprintf(cmdLine, "\"%s\" %s %s %s \"%s\" \"%s\"",
             (const char*)path.getCString(),             (const char*)path.getCString(),
               "0",    // Do not set user context in cimprovagt
             readHandle,             readHandle,
             writeHandle,             writeHandle,
               (const char*)userName.getCString(),
             module);             module);
  
         //  Create provider agent proess.         //  Create provider agent proess.
Line 308 
Line 310 
             String path = FileSystem::getAbsolutePath(             String path = FileSystem::getAbsolutePath(
                 pegasusHome.getCString(), PEGASUS_PROVIDER_AGENT_PROC_NAME);                 pegasusHome.getCString(), PEGASUS_PROVIDER_AGENT_PROC_NAME);
  
 #  if !defined(PEGASUS_DISABLE_PROV_USERCTXT)  
   
             PEGASUS_UID_T newUid = (PEGASUS_UID_T)-1;  
             PEGASUS_GID_T newGid = (PEGASUS_GID_T)-1;  
   
             if (userName != System::getEffectiveUserName())  
             {  
                 if (!System::lookupUserId(  
                          userName.getCString(), newUid, newGid))  
                 {  
                     PEG_TRACE((TRC_DISCARDED_DATA, Tracer::LEVEL2,  
                         "System::lookupUserId(%s) failed.",  
                         (const char*)userName.getCString()));  
                     return -1;  
                 }  
             }  
   
 #  endif /* !defined(PEGASUS_DISABLE_PROV_USERCTXT) */  
   
             // Create "to-agent" pipe:             // Create "to-agent" pipe:
  
             if (pipe(to) != 0)             if (pipe(to) != 0)
Line 377 
Line 360 
  
 #  endif /* !defined(PEGASUS_OS_VMS) */ #  endif /* !defined(PEGASUS_OS_VMS) */
  
 #  if !defined(PEGASUS_DISABLE_PROV_USERCTXT)  
   
                 // Set uid and gid for the new provider agent process.  
   
                 if (newUid != (PEGASUS_UID_T)-1 && newGid != (PEGASUS_GID_T)-1)  
                 {  
                     if (!System::changeUserContext_SingleThreaded(  
                              userName.getCString(), newUid, newGid))  
                     {  
                         return -1;  
                     }  
                 }  
   
 #  endif /* !defined(PEGASUS_DISABLE_PROV_USERCTXT) */  
   
                 // Exec the cimprovagt program.                 // Exec the cimprovagt program.
  
                 char arg1[32];                  char toPipeArg[32];
                 char arg2[32];                  char fromPipeArg[32];
                 sprintf(arg1, "%d", to[0]);                  sprintf(toPipeArg, "%d", to[0]);
                 sprintf(arg2, "%d", from[1]);                  sprintf(fromPipeArg, "%d", from[1]);
  
                 {                 {
                     CString cstr = path.getCString();                     CString cstr = path.getCString();
                     if (execl(cstr, cstr, arg1, arg2, module, (char*)0) == -1)                      if (execl(
                               cstr,
                               cstr,
   #  if !defined(PEGASUS_DISABLE_PROV_USERCTXT) && !defined(PEGASUS_OS_ZOS)
                               "1",    // Set user context in cimprovagt
   #  else
                               "0",    // Do not set user context in cimprovagt
   #  endif
                               toPipeArg,
                               fromPipeArg,
                               (const char*)userName.getCString(),
                               module,
                               (char*)0) == -1)
                     {                     {
                         PEG_TRACE((TRC_DISCARDED_DATA, Tracer::LEVEL2,                         PEG_TRACE((TRC_DISCARDED_DATA, Tracer::LEVEL2,
                             "execl() failed.  errno = %d.", errno));                             "execl() failed.  errno = %d.", errno));
Line 433 
Line 413 
         readPipe = new AnonymousPipe(readFdStr, 0);         readPipe = new AnonymousPipe(readFdStr, 0);
         writePipe = new AnonymousPipe(0, writeFdStr);         writePipe = new AnonymousPipe(0, writeFdStr);
  
   #  if defined(PEGASUS_HAS_SIGNALS)
   #   if !defined(PEGASUS_DISABLE_PROV_USERCTXT) && !defined(PEGASUS_OS_ZOS)
           // The cimprovagt forks and returns right away.  Clean up the zombie
           // process now instead of in reapProviderAgent().
           int status = 0;
           while ((status = waitpid(pid, 0, 0)) == -1 && errno == EINTR)
               ;
   #   endif
   #  endif
   
         return 0;         return 0;
  
 # endif /* POSIX CASE */ # endif /* POSIX CASE */
Line 459 
Line 449 
         int status = 0;         int status = 0;
  
 # if defined(PEGASUS_HAS_SIGNALS) # if defined(PEGASUS_HAS_SIGNALS)
   #  if defined(PEGASUS_DISABLE_PROV_USERCTXT) || defined(PEGASUS_OS_ZOS)
           // When provider user context is enabled, this is done in
           // startProviderAgent().
         while ((status = waitpid(pid, 0, 0)) == -1 && errno == EINTR)         while ((status = waitpid(pid, 0, 0)) == -1 && errno == EINTR)
             ;             ;
 # endif # endif
   # endif
  
         return status;         return status;
  


Legend:
Removed from v.1.12  
changed lines
  Added in v.1.12.4.3

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2