Changeset 55590 in vbox
- Timestamp:
- May 1, 2015 8:24:07 PM (10 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/idl/VirtualBox.xidl
r55586 r55590 10783 10783 <interface 10784 10784 name="IGuestSession" extends="$unknown" 10785 uuid=" c899776d-41f7-7aee-7056-4bac979d58b7"10785 uuid="e1fa83fe-437d-3e3a-9278-4297f1ca95dd" 10786 10786 wsmap="managed" 10787 10787 > … … 11107 11107 <param name="acl" type="wstring" dir="in"> 11108 11108 <desc>Actual ACL string to set. Must comply with the guest OS.</desc> 11109 </param>11110 </method>11111 11112 <!-- r=bird: Remove this it duplicates the 'environment' attribute. -->11113 <method name="environmentClear">11114 <desc>11115 Clears (deletes) all session environment variables.11116 11117 <result name="VBOX_E_IPRT_ERROR">11118 <!-- r=bird: No, it won't return this result, because you're just doing .clear() on a vector. -->11119 Error while clearing the session environment variables.11120 </result>11121 </desc>11122 </method>11123 11124 <method name="environmentGet">11125 <!-- r=bird: Remove this because the interface isn't suitable for returning11126 'unset' or empty values, and it can easily be misunderstood. Besides there is11127 hardly a usecase for it as long as it just works on environment changes and11128 there is the 'environment' attribute. -->11129 <desc>11130 Gets the value of an environment variable scheduled to be set.11131 11132 <result name="VBOX_E_IPRT_ERROR">11133 <!-- r=bird: Would never return this, only invalid input or out of memory. -->11134 Error while getting the value of the session environment variable.11135 </result>11136 </desc>11137 <param name="name" type="wstring" dir="in">11138 <desc>Name of session environment variable to get the value for.</desc>11139 </param>11140 <param name="value" type="wstring" dir="return">11141 <desc>11142 Value of the session environment variable specified. If this variable11143 does not exist an empty value will be returned.11144 <note>11145 An empty value will also be return for a variable with an value or11146 a unset-variable entry.11147 </note>11148 </desc>11149 11109 </param> 11150 11110 </method> -
trunk/src/VBox/Main/include/GuestSessionImpl.h
r55588 r55590 312 312 HRESULT directorySetACL(const com::Utf8Str &aPath, 313 313 const com::Utf8Str &aAcl); 314 HRESULT environmentClear();315 HRESULT environmentGet(const com::Utf8Str &aName,316 com::Utf8Str &aValue);317 314 HRESULT environmentSet(const com::Utf8Str &aName, 318 315 const com::Utf8Str &aValue); -
trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp
r55588 r55590 2904 2904 } 2905 2905 2906 /** @todo remove this it duplicates the 'environment' attribute. */2907 HRESULT GuestSession::environmentClear()2908 {2909 #ifndef VBOX_WITH_GUEST_CONTROL2910 ReturnComNotImplemented();2911 #else2912 LogFlowThisFuncEnter();2913 2914 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);2915 2916 mData.mEnvironment.reset();2917 2918 LogFlowThisFuncLeave();2919 return S_OK;2920 #endif /* VBOX_WITH_GUEST_CONTROL */2921 }2922 2923 /** @todo Remove this because the interface isn't suitable for returning 'unset'2924 * or empty values, and it can easily be misunderstood. Besides there2925 * is hardly a usecase for it as long as it just works on2926 * environment changes and there is the 'environment' attribute. */2927 HRESULT GuestSession::environmentGet(const com::Utf8Str &aName, com::Utf8Str &aValue)2928 {2929 #ifndef VBOX_WITH_GUEST_CONTROL2930 ReturnComNotImplemented();2931 #else2932 LogFlowThisFuncEnter();2933 2934 HRESULT hrc;2935 if (RT_LIKELY(aName.isNotEmpty()))2936 {2937 if (RT_LIKELY(strchr(aName.c_str(), '=') == NULL))2938 {2939 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);2940 2941 mData.mEnvironment.getVariable(aName, &aValue);2942 hrc = S_OK;2943 }2944 else2945 hrc = setError(E_INVALIDARG, tr("The equal char is not allowed in environment variable names"));2946 }2947 else2948 hrc = setError(E_INVALIDARG, tr("No variable name specified"));2949 2950 LogFlowThisFuncLeave();2951 return hrc;2952 #endif /* VBOX_WITH_GUEST_CONTROL */2953 }2954 2955 2906 HRESULT GuestSession::environmentSet(const com::Utf8Str &aName, const com::Utf8Str &aValue) 2956 2907 { -
trunk/src/VBox/ValidationKit/tests/additions/tdAddGuestCtrl.py
r55535 r55590 1134 1134 break; 1135 1135 try: 1136 for (_, aEnv) in enumerate(curTest.aEnv): # Enumerate only will work with a sequence (e.g > 1 entries).1136 for (_, aEnv) in enumerate(curTest.aEnv): 1137 1137 aElems = aEnv.split('='); 1138 strKey = ''; 1138 strKey = ''; ## @todo s/Key/Var/g 1139 1139 strValue = ''; 1140 1140 if len(aElems) > 0: … … 1142 1142 if len(aElems) == 2: 1143 1143 strValue = aElems[1]; 1144 reporter.log2('Test #%d: Single key="%s", value="%s" (%d) ...' \1144 reporter.log2('Test #%d: Single var="%s", value="%s" (%d) ...' \ 1145 1145 % (i, strKey, strValue, len(aElems))); 1146 1146 try: … … 1157 1157 else: 1158 1158 reporter.log('Test #%d: API reported an error (single), good' % (i,)); 1159 reporter.log2('Getting key="%s" ...' % (strKey,)); 1160 try: 1161 strValue2 = curGuestSession.environmentGet(strKey); 1162 if strKey.isalnum() \ 1163 and strValue != strValue2: 1164 reporter.error('Test #%d failed: Got environment variable "%s", expected "%s" (key: "%s")' \ 1165 % (i, strValue2, strValue, strKey)); 1166 fRc = False; 1167 break; 1168 # Getting back an empty value when specifying an invalid key is fine. 1169 reporter.log2('Got key "%s=%s"' % (strKey, strValue2)); 1170 except UnicodeDecodeError: # Might happen on unusal values, fine. 1171 if strValue != strValue2: 1172 reporter.error('Test #%d failed: Got (undecoded) environment variable "%s", ' \ 1173 'expected "%s" (key: "%s")' \ 1174 % (i, strValue2, strValue, strKey)); 1175 fRc = False; 1176 break; 1177 except: 1178 if strKey == "" \ 1179 or not strKey.isalnum(): 1180 reporter.log('Test #%d: API reported an error (invalid key "%s"), good' % (i, strKey)); 1181 else: 1182 reporter.errorXcpt('Test #%d failed: Getting environment variable:' % (i)); 1159 ## @todo environmentGet() has been removed in 5.0 because it's not up to the task of returning all the 1160 ## putenv strings forms and gives the impression that the envrionment is something it isn't. This test 1161 ## should be rewritten using the attribute. What's more, there should be an Unset test here, shouldn't 1162 ## there? 1163 # 1164 #reporter.log2('Getting key="%s" ...' % (strKey,)); 1165 #try: 1166 # strValue2 = curGuestSession.environmentGet(strKey); 1167 # if strKey.isalnum() \ 1168 # and strValue != strValue2: 1169 # reporter.error('Test #%d failed: Got environment value "%s", expected "%s" (var: "%s")' \ 1170 # % (i, strValue2, strValue, strKey)); 1171 # fRc = False; 1172 # break; 1173 # # Getting back an empty value when specifying an invalid key is fine. 1174 # reporter.log2('Got key "%s=%s"' % (strKey, strValue2)); 1175 #except UnicodeDecodeError: # Might happen on unusal values, fine. 1176 # if strValue != strValue2: 1177 # reporter.error('Test #%d failed: Got (undecoded) environment variable "%s", ' \ 1178 # 'expected "%s" (var: "%s")' \ 1179 # % (i, strValue2, strValue, strKey)); 1180 # fRc = False; 1181 # break; 1182 #except: 1183 # if strKey == "" \ 1184 # or not strKey.isalnum(): 1185 # reporter.log('Test #%d: API reported an error (invalid key "%s"), good' % (i, strKey)); 1186 # else: 1187 # reporter.errorXcpt('Test #%d failed: Getting environment variable:' % (i)); 1183 1188 if fRc is False: 1184 1189 continue; … … 1209 1214 fRc = False; 1210 1215 break; 1211 curGuestSession.environmentClear(); # No return (e.g. boolean) value available thru wrapper. 1216 1217 self.oTstDrv.oVBoxMgr.setArray(curGuestSession, 'environment', []); 1212 1218 curEnv = self.oTstDrv.oVBoxMgr.getArray(curGuestSession, 'environment'); 1213 1219 if len(curEnv) is not 0:
Note:
See TracChangeset
for help on using the changeset viewer.