|
@@ -31,7 +31,7 @@
|
31
|
31
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
32
|
32
|
*/
|
33
|
33
|
|
34
|
|
-FEATURE ( FEATURE_MISC, "PXEXT", DHCP_EB_FEATURE_PXE_EXT, 1 );
|
|
34
|
+FEATURE ( FEATURE_MISC, "PXEXT", DHCP_EB_FEATURE_PXE_EXT, 2 );
|
35
|
35
|
|
36
|
36
|
/**
|
37
|
37
|
* FILE OPEN
|
|
@@ -189,3 +189,41 @@ PXENV_EXIT_t pxenv_get_file_size ( struct s_PXENV_GET_FILE_SIZE
|
189
|
189
|
get_file_size->Status = PXENV_STATUS_SUCCESS;
|
190
|
190
|
return PXENV_EXIT_SUCCESS;
|
191
|
191
|
}
|
|
192
|
+
|
|
193
|
+/**
|
|
194
|
+ * FILE EXEC
|
|
195
|
+ *
|
|
196
|
+ * @v file_exec Pointer to a struct s_PXENV_FILE_EXEC
|
|
197
|
+ * @v s_PXENV_FILE_EXEC::Command Command to execute
|
|
198
|
+ * @ret #PXENV_EXIT_SUCCESS Command was executed successfully
|
|
199
|
+ * @ret #PXENV_EXIT_FAILURE Command was not executed successfully
|
|
200
|
+ * @ret s_PXENV_FILE_EXEC::Status PXE status code
|
|
201
|
+ *
|
|
202
|
+ */
|
|
203
|
+PXENV_EXIT_t pxenv_file_exec ( struct s_PXENV_FILE_EXEC *file_exec ) {
|
|
204
|
+ userptr_t command;
|
|
205
|
+ size_t command_len;
|
|
206
|
+ int rc;
|
|
207
|
+
|
|
208
|
+ DBG ( "PXENV_FILE_EXEC" );
|
|
209
|
+
|
|
210
|
+ /* Copy name from external program, and exec it */
|
|
211
|
+ command = real_to_user ( file_exec->Command.segment,
|
|
212
|
+ file_exec->Command.offset );
|
|
213
|
+ command_len = strlen_user ( command, 0 );
|
|
214
|
+ {
|
|
215
|
+ char command_string[ command_len + 1 ];
|
|
216
|
+
|
|
217
|
+ copy_from_user ( command_string, command, 0,
|
|
218
|
+ sizeof ( command_string ) );
|
|
219
|
+ DBG ( " %s", command_string );
|
|
220
|
+
|
|
221
|
+ if ( ( rc = system ( command_string ) ) != 0 ) {
|
|
222
|
+ file_exec->Status = PXENV_STATUS ( rc );
|
|
223
|
+ return PXENV_EXIT_FAILURE;
|
|
224
|
+ }
|
|
225
|
+ }
|
|
226
|
+
|
|
227
|
+ file_exec->Status = PXENV_STATUS_SUCCESS;
|
|
228
|
+ return PXENV_EXIT_SUCCESS;
|
|
229
|
+}
|