Changeset 30252 in vbox for trunk/src/VBox/Additions/WINNT/VBoxCredProv/VBoxCredPoller.cpp
- Timestamp:
- Jun 16, 2010 1:48:29 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/VBoxCredProv/VBoxCredPoller.cpp
r28800 r30252 5 5 6 6 /* 7 * Copyright (C) 20 09Oracle Corporation7 * Copyright (C) 2010 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 57 57 m_pProv->AddRef(); 58 58 59 /* don't create more than one of them*/59 /* Don't create more than one of them. */ 60 60 if (m_hThreadPoller != NIL_RTTHREAD) 61 61 { … … 68 68 Log(("VBoxCredPoller: Could not init critical section! rc = %Rrc\n", rc)); 69 69 70 /* create the poller thread*/70 /* Create the poller thread. */ 71 71 rc = RTThreadCreate(&m_hThreadPoller, VBoxCredPoller::threadPoller, this, 0, RTTHREADTYPE_INFREQUENT_POLLER, 72 72 RTTHREADFLAGS_WAITABLE, "creds"); … … 90 90 } 91 91 92 /* Post termination event semaphore */92 /* Post termination event semaphore. */ 93 93 int rc = RTThreadUserSignal(m_hThreadPoller); 94 94 if (RT_SUCCESS(rc)) 95 95 { 96 96 Log(("VBoxCredPoller::Shutdown: Waiting for thread to terminate\n")); 97 /* wait until the thread has terminated*/97 /* Wait until the thread has terminated. */ 98 98 rc = RTThreadWait(m_hThreadPoller, RT_INDEFINITE_WAIT, NULL); 99 99 Log(("VBoxCredPoller::Shutdown: Thread has (probably) terminated (rc = %Rrc)\n", rc)); … … 101 101 else 102 102 { 103 /* failed to signal the thread - very unlikely - so no point in waiting long. */103 /* Failed to signal the thread - very unlikely - so no point in waiting long. */ 104 104 Log(("VBoxCredPoller::Shutdown: Failed to signal semaphore, rc = %Rrc\n", rc)); 105 105 rc = RTThreadWait(m_hThreadPoller, 100, NULL); … … 125 125 credentialsReset(); 126 126 127 /* get credentials*/127 /* Get credentials. */ 128 128 RTCritSectEnter(&m_csCredUpate); 129 129 int rc = VbglR3CredentialsRetrieve(&m_pszUser, &m_pszPw, &m_pszDomain); 130 130 if (RT_SUCCESS(rc)) 131 131 { 132 Log(("VBoxCredPoller::credentialsRetrieve: Credentials retrieved (user=%s, pw=%s, domain=%s)\n", 132 /* NULL/free domain if it's empty (""). */ 133 if (m_pszDomain && strlen(m_pszDomain) == 0) 134 { 135 RTStrFree(m_pszDomain); 136 m_pszDomain = NULL; 137 } 138 139 Log(("VBoxCredPoller::credentialsRetrieve: Credentials retrieved (User=%s, Password=%s, Domain=%s)\n", 133 140 m_pszUser ? m_pszUser : "<empty>", 134 141 m_pszPw ? m_pszPw : "<empty>", 135 m_pszDomain ? m_pszDomain : "<empty>")); 136 137 /* allocated but empty? delete and re-fill with default value in block below. */ 138 if (strlen(m_pszDomain) == 0) 139 { 140 RTStrFree(m_pszDomain); 141 m_pszDomain = NULL; 142 } 143 144 /* if we don't have a domain specified, fill in a dot (".") specifying the 145 * local computer. */ 146 if (m_pszDomain == NULL) 147 { 148 rc = RTStrAPrintf(&m_pszDomain, "."); 149 if (RT_FAILURE(rc)) 150 Log(("VBoxCredPoller::credentialsRetrieve: Could not set default domain name, rc = %Rrc", rc)); 151 else 152 Log(("VBoxCredPoller::credentialsRetrieve: No domain name given, set default value to: %s\n", m_pszDomain)); 153 } 154 } 155 156 /* if all went fine, notify parent */ 157 if (RT_SUCCESS(rc)) 158 { 142 m_pszDomain ? m_pszDomain : "NULL")); 143 159 144 AssertPtr(m_pProv); 160 m_pProv->OnCredentialsProvided(m_pszUser, 161 m_pszPw, 162 m_pszDomain); 145 m_pProv->OnCredentialsProvided(); 163 146 } 164 147 RTCritSectLeave(&m_csCredUpate); … … 216 199 if (RT_FAILURE(rc)) 217 200 { 218 if (rc == VERR_NOT_FOUND) 219 Log(("VBoxCredPoller::threadPoller: No credentials availabe.\n")); 220 else 201 if (rc != VERR_NOT_FOUND) 221 202 Log(("VBoxCredPoller::threadPoller: Could not retrieve credentials! rc = %Rc\n", rc)); 222 203 } … … 228 209 } 229 210 230 /* wait a bit*/211 /* Wait a bit. */ 231 212 if (RTThreadUserWait(ThreadSelf, 500) == VINF_SUCCESS) 232 213 { 233 214 Log(("VBoxCredPoller::threadPoller: Terminating\n")); 234 /* we were asked to terminate, do that instantly! */215 /* We were asked to terminate, do that instantly! */ 235 216 return 0; 236 217 }
Note:
See TracChangeset
for help on using the changeset viewer.