(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.1.2.11 and 1.1.2.12

version 1.1.2.11, 2007/01/09 17:46:28 version 1.1.2.12, 2007/01/09 20:25:40
Line 82 
Line 82 
 //////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
 //// ////
 //// InProcess stubs:  //// Loopback stubs:
 //// ////
 //////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
  
 static int InProcess_ping()  static int Loopback_ping()
 { {
     // Nothing to do.     // Nothing to do.
     return 0;     return 0;
 } }
  
 FILE* InProcess_openFile(  FILE* Loopback_openFile(
     const char* path,     const char* path,
     int mode)     int mode)
 { {
Line 113 
Line 113 
     }     }
 } }
  
 static int InProcess_renameFile(  static int Loopback_renameFile(
     const char* oldPath,     const char* oldPath,
     const char* newPath)     const char* newPath)
 { {
     return FileSystem::renameFile(oldPath, newPath) ? 0 : -1;     return FileSystem::renameFile(oldPath, newPath) ? 0 : -1;
 } }
  
 static int InProcess_removeFile(  static int Loopback_removeFile(
     const char* path)     const char* path)
 { {
     return FileSystem::removeFile(path) ? 0 : -1;     return FileSystem::removeFile(path) ? 0 : -1;
Line 148 
Line 148 
  
 #if defined(PEGASUS_OS_TYPE_WINDOWS) #if defined(PEGASUS_OS_TYPE_WINDOWS)
  
 static int InProcess_startProviderAgent(  static int Loopback_startProviderAgent(
     const char* module,     const char* module,
     int uid,     int uid,
     int gid,     int gid,
Line 241 
Line 241 
  
 #elif defined(PEGASUS_OS_OS400) #elif defined(PEGASUS_OS_OS400)
  
 static int InProcess_startProviderAgent(  static int Loopback_startProviderAgent(
     const char* module,     const char* module,
     int uid,     int uid,
     int gid,     int gid,
Line 255 
Line 255 
  
 #else /* POSIX CASE FOLLOWS */ #else /* POSIX CASE FOLLOWS */
  
 static int InProcess_startProviderAgent(  static int Loopback_startProviderAgent(
     const SessionKey& sessionKey,     const SessionKey& sessionKey,
     const char* module,     const char* module,
     int uid,     int uid,
Line 401 
Line 401 
  
 #endif /* !defined(START_PROVIDER_AGENT) */ #endif /* !defined(START_PROVIDER_AGENT) */
  
 static int InProcess_daemonizeExecutor()  static int Loopback_daemonizeExecutor()
 { {
     // Nothing to do.     // Nothing to do.
     return 0;     return 0;
 } }
  
 static int InProcess_changeOwner(  static int Loopback_changeOwner(
     const char* path,     const char* path,
     const char* owner)     const char* owner)
 { {
     return FileSystem::changeFileOwner(path, owner) ? 0 : -1;     return FileSystem::changeFileOwner(path, owner) ? 0 : -1;
 } }
  
 static int InProcess_waitPid(  static int Loopback_reapProviderAgent(
       const SessionKey& sessionKey,
     int pid)     int pid)
 { {
     int status;     int status;
Line 425 
Line 426 
     return status;     return status;
 } }
  
 static int InProcess_authenticatePassword(  static int Loopback_authenticatePassword(
     const char* username,     const char* username,
     const char* password,     const char* password,
     SessionKey& sessionKey)     SessionKey& sessionKey)
Line 439 
Line 440 
 #endif #endif
 } }
  
 static int InProcess_validateUser(  static int Loopback_validateUser(
     const char* username)     const char* username)
 { {
 #if defined(PEGASUS_PAM_AUTHENTICATION) #if defined(PEGASUS_PAM_AUTHENTICATION)
Line 584 
Line 585 
     return 0;     return 0;
 } }
  
 static int OutOfProcess_ping()  static int Socket_ping()
 { {
     AutoMutex autoMutex(_mutex);     AutoMutex autoMutex(_mutex);
  
Line 607 
Line 608 
     return -1;     return -1;
 } }
  
 FILE* OutOfProcess_openFile(  FILE* Socket_openFile(
     const char* path,     const char* path,
     int mode)     int mode)
 { {
Line 664 
Line 665 
     return NULL;     return NULL;
 } }
  
 static int OutOfProcess_renameFile(  static int Socket_renameFile(
     const char* oldPath,     const char* oldPath,
     const char* newPath)     const char* newPath)
 { {
Line 698 
Line 699 
     return response.status;     return response.status;
 } }
  
 static int OutOfProcess_removeFile(  static int Socket_removeFile(
     const char* path)     const char* path)
 { {
     AutoMutex autoMutex(_mutex);     AutoMutex autoMutex(_mutex);
Line 730 
Line 731 
     return response.status;     return response.status;
 } }
  
 static int OutOfProcess_startProviderAgent(  static int Socket_startProviderAgent(
     const SessionKey& sessionKey,     const SessionKey& sessionKey,
     const char* module,     const char* module,
     int uid,     int uid,
Line 819 
Line 820 
     return result;     return result;
 } }
  
 static int OutOfProcess_daemonizeExecutor()  static int Socket_daemonizeExecutor()
 { {
     AutoMutex autoMutex(_mutex);     AutoMutex autoMutex(_mutex);
  
Line 841 
Line 842 
     return response.status;     return response.status;
 } }
  
 static int OutOfProcess_waitPid(  static int Socket_reapProviderAgent(
       const SessionKey& sessionKey,
     int pid)     int pid)
 { {
     AutoMutex autoMutex(_mutex);     AutoMutex autoMutex(_mutex);
Line 849 
Line 851 
     // _send request header:     // _send request header:
  
     ExecutorRequestHeader header;     ExecutorRequestHeader header;
     header.code = EXECUTOR_WAIT_PID_MESSAGE;      header.code = EXECUTOR_REAP_PROVIDER_AGENT;
  
     if (_send(_getSock(), &header, sizeof(header)) != sizeof(header))     if (_send(_getSock(), &header, sizeof(header)) != sizeof(header))
         return -1;         return -1;
  
     // _send request body:     // _send request body:
  
     ExecutorWaitPidRequest request;      ExecutorReapProviderAgentRequest request;
       memset(&request, 0, sizeof(request));
       Strlcpy(request.key, sessionKey.data(), sizeof(request.key));
     request.pid = pid;     request.pid = pid;
  
     if (_send(_getSock(), &request, sizeof(request)) != sizeof(request))     if (_send(_getSock(), &request, sizeof(request)) != sizeof(request))
Line 864 
Line 868 
  
     // Receive the response     // Receive the response
  
     ExecutorWaitPidResponse response;      ExecutorReapProviderAgentResponse response;
  
     if (_recv(_getSock(), &response, sizeof(response)) != sizeof(response))     if (_recv(_getSock(), &response, sizeof(response)) != sizeof(response))
         return -1;         return -1;
Line 872 
Line 876 
     return response.status;     return response.status;
 } }
  
 static int OutOfProcess_authenticatePassword(  static int Socket_authenticatePassword(
     const char* username,     const char* username,
     const char* password,     const char* password,
     SessionKey& sessionKey)     SessionKey& sessionKey)
Line 911 
Line 915 
     return response.status;     return response.status;
 } }
  
 static int OutOfProcess_validateUser(  static int Socket_validateUser(
     const char* username)     const char* username)
 { {
     AutoMutex autoMutex(_mutex);     AutoMutex autoMutex(_mutex);
Line 943 
Line 947 
     return response.status;     return response.status;
 } }
  
 int OutOfProcess_challengeLocal(  int Socket_challengeLocal(
     const char* user,     const char* user,
     char challenge[EXECUTOR_BUFFER_SIZE],     char challenge[EXECUTOR_BUFFER_SIZE],
     SessionKey& sessionKey)     SessionKey& sessionKey)
Line 982 
Line 986 
     return response.status;     return response.status;
 } }
  
 int OutOfProcess_authenticateLocal(  int Socket_authenticateLocal(
     const SessionKey& sessionKey,     const SessionKey& sessionKey,
     const char* token)     const char* token)
 { {
Line 1016 
Line 1020 
     return response.status;     return response.status;
 } }
  
 int OutOfProcess_newSessionKey(  int Socket_newSessionKey(
     const char username[EXECUTOR_BUFFER_SIZE],     const char username[EXECUTOR_BUFFER_SIZE],
     SessionKey& sessionKey)     SessionKey& sessionKey)
 { {
Line 1053 
Line 1057 
     return response.status;     return response.status;
 } }
  
 int OutOfProcess_deleteSessionKey(  int Socket_deleteSessionKey(
     const SessionKey& sessionKey)     const SessionKey& sessionKey)
 { {
     AutoMutex autoMutex(_mutex);     AutoMutex autoMutex(_mutex);
Line 1113 
Line 1117 
 int Executor::ping() int Executor::ping()
 { {
     if (_getSock() == -1)     if (_getSock() == -1)
         return InProcess_ping();          return Loopback_ping();
  
 #if defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION) #if defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION)
     return OutOfProcess_ping();      return Socket_ping();
 #else #else
     return -1;     return -1;
 #endif /* defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION) */ #endif /* defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION) */
Line 1127 
Line 1131 
     int mode)     int mode)
 { {
     if (_getSock() == -1)     if (_getSock() == -1)
         return InProcess_openFile(path, mode);          return Loopback_openFile(path, mode);
  
 #if defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION) #if defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION)
     return OutOfProcess_openFile(path, mode);      return Socket_openFile(path, mode);
 #else #else
     return NULL;     return NULL;
 #endif /* defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION) */ #endif /* defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION) */
Line 1141 
Line 1145 
     const char* newPath)     const char* newPath)
 { {
     if (_getSock() == -1)     if (_getSock() == -1)
         return InProcess_renameFile(oldPath, newPath);          return Loopback_renameFile(oldPath, newPath);
  
 #if defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION) #if defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION)
     return OutOfProcess_renameFile(oldPath, newPath);      return Socket_renameFile(oldPath, newPath);
 #else #else
     return -1;     return -1;
 #endif /* defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION) */ #endif /* defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION) */
Line 1154 
Line 1158 
     const char* path)     const char* path)
 { {
     if (_getSock() == -1)     if (_getSock() == -1)
         return InProcess_removeFile(path);          return Loopback_removeFile(path);
  
 #if defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION) #if defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION)
     return OutOfProcess_removeFile(path);      return Socket_removeFile(path);
 #else #else
     return -1;     return -1;
 #endif /* defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION) */ #endif /* defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION) */
Line 1174 
Line 1178 
     AnonymousPipe*& writePipe)     AnonymousPipe*& writePipe)
 { {
     if (_getSock() == -1)     if (_getSock() == -1)
         return InProcess_startProviderAgent(sessionKey, module,          return Loopback_startProviderAgent(sessionKey, module,
             uid, gid, pid, providerAgentSessionKey, readPipe, writePipe);             uid, gid, pid, providerAgentSessionKey, readPipe, writePipe);
  
 #if defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION) #if defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION)
     return OutOfProcess_startProviderAgent(sessionKey, module,      return Socket_startProviderAgent(sessionKey, module,
         uid, gid, pid, providerAgentSessionKey, readPipe, writePipe);         uid, gid, pid, providerAgentSessionKey, readPipe, writePipe);
 #else #else
     providerAgentSessionKey.clear();     providerAgentSessionKey.clear();
Line 1189 
Line 1193 
 int Executor::daemonizeExecutor() int Executor::daemonizeExecutor()
 { {
     if (_getSock() == -1)     if (_getSock() == -1)
         return InProcess_daemonizeExecutor();          return Loopback_daemonizeExecutor();
  
 #if defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION) #if defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION)
     return OutOfProcess_daemonizeExecutor();      return Socket_daemonizeExecutor();
 #else #else
     return -1;     return -1;
 #endif /* defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION) */ #endif /* defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION) */
 } }
  
 int Executor::waitPid(  int Executor::reapProviderAgent(
       const SessionKey& sessionKey,
     int pid)     int pid)
 { {
     if (_getSock() == -1)     if (_getSock() == -1)
         return InProcess_waitPid(pid);          return Loopback_reapProviderAgent(sessionKey, pid);
  
 #if defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION) #if defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION)
     return OutOfProcess_waitPid(pid);      return Socket_reapProviderAgent(sessionKey, pid);
 #else #else
     return -1;     return -1;
 #endif /* defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION) */ #endif /* defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION) */
Line 1217 
Line 1222 
     SessionKey& sessionKey)     SessionKey& sessionKey)
 { {
     if (_getSock() == -1)     if (_getSock() == -1)
         return InProcess_authenticatePassword(username, password, sessionKey);          return Loopback_authenticatePassword(username, password, sessionKey);
  
 #if defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION) #if defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION)
     return OutOfProcess_authenticatePassword(username, password, sessionKey);      return Socket_authenticatePassword(username, password, sessionKey);
 #else #else
     sessionKey.clear();     sessionKey.clear();
     return -1;     return -1;
Line 1231 
Line 1236 
     const char* username)     const char* username)
 { {
     if (_getSock() == -1)     if (_getSock() == -1)
         return InProcess_validateUser(username);          return Loopback_validateUser(username);
  
 #if defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION) #if defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION)
     return OutOfProcess_validateUser(username);      return Socket_validateUser(username);
 #else #else
     return -1;     return -1;
 #endif /* defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION) */ #endif /* defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION) */
Line 1249 
Line 1254 
         return -1;         return -1;
  
 #if defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION) #if defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION)
     return OutOfProcess_challengeLocal(user, path, sessionKey);      return Socket_challengeLocal(user, path, sessionKey);
 #else #else
     sessionKey.clear();     sessionKey.clear();
     return -1;     return -1;
Line 1264 
Line 1269 
         return -1;         return -1;
  
 #if defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION) #if defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION)
     return OutOfProcess_authenticateLocal(sessionKey, challengeResponse);      return Socket_authenticateLocal(sessionKey, challengeResponse);
 #else #else
     return -1;     return -1;
 #endif /* defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION) */ #endif /* defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION) */
Line 1275 
Line 1280 
     SessionKey& sessionKey)     SessionKey& sessionKey)
 { {
     if (_getSock() == -1)     if (_getSock() == -1)
         return -1;      {
           sessionKey.clear();
           return 0;
       }
  
 #if defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION) #if defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION)
     return OutOfProcess_newSessionKey(username, sessionKey);      return Socket_newSessionKey(username, sessionKey);
 #else #else
     sessionKey.clear();      return -1;
     return 0;  
 #endif /* defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION) */ #endif /* defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION) */
 } }
  
Line 1289 
Line 1296 
     const SessionKey& sessionKey)     const SessionKey& sessionKey)
 { {
     if (_getSock() == -1)     if (_getSock() == -1)
         return -1;          return 0;
  
 #if defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION) #if defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION)
     return OutOfProcess_deleteSessionKey(sessionKey);      return Socket_deleteSessionKey(sessionKey);
 #else #else
     return 0;     return 0;
 #endif /* defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION) */ #endif /* defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION) */


Legend:
Removed from v.1.1.2.11  
changed lines
  Added in v.1.1.2.12

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2