Changeset 93895 in vbox for trunk/src/VBox/ValidationKit/utils/TestExecServ
- Timestamp:
- Feb 23, 2022 12:48:02 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/utils/TestExecServ/TestExecService.cpp
r93747 r93895 660 660 * @returns true if valid, false if invalid. 661 661 * @param pPktHdr The packet being unpacked. 662 * @param pszArgName 662 * @param pszArgName The argument name. 663 663 * @param psz Pointer to the string within pPktHdr. 664 664 * @param ppszExp Where to return the expanded string. Must be … … 1007 1007 1008 1008 RTStrFree(pszPath); 1009 return rc; 1010 } 1011 1012 /** 1013 * Copies a file from the source to the destination locally. 1014 * 1015 * @returns IPRT status code from send. 1016 * @param pPktHdr The copy file packet. 1017 */ 1018 static int txsDoCopyFile(PCTXSPKTHDR pPktHdr) 1019 { 1020 /* After the packet header follows a 32-bit file mode, 1021 * the remainder of the packet are two zero terminated paths. */ 1022 size_t const cbMin = sizeof(TXSPKTHDR) + sizeof(RTFMODE) + 2; 1023 if (pPktHdr->cb < cbMin) 1024 return txsReplyBadMinSize(pPktHdr, cbMin); 1025 1026 RTFMODE const fMode = *(RTFMODE const *)(pPktHdr + 1); 1027 1028 int rc; 1029 1030 char *pszSrc; 1031 const char *pch; 1032 if (txsIsStringValid(pPktHdr, "source", (const char *)(pPktHdr + 1) + sizeof(uint32_t) * 2, &pszSrc, &pch, &rc)) 1033 { 1034 char *pszDst; 1035 if (txsIsStringValid(pPktHdr, "dest", pch, &pszDst, NULL /* Check for string termination */, &rc)) 1036 { 1037 rc = RTFileCopy(pszSrc, pszDst); 1038 if (RT_SUCCESS(rc)) 1039 { 1040 if (fMode) /* Do we need to set the file mode? */ 1041 { 1042 rc = RTPathSetMode(pszDst, fMode); 1043 if (RT_FAILURE(rc)) 1044 rc = txsReplyRC(pPktHdr, rc, "RTPathSetMode(\"%s\", %#x)", pszDst, fMode); 1045 } 1046 1047 if (RT_SUCCESS(rc)) 1048 rc = txsReplyAck(pPktHdr); 1049 } 1050 else 1051 rc = txsReplyRC(pPktHdr, rc, "RTFileCopy"); 1052 RTStrFree(pszDst); 1053 } 1054 1055 RTStrFree(pszSrc); 1056 } 1057 1009 1058 return rc; 1010 1059 } … … 3105 3154 else if (txsIsSameOpcode(pPktHdr, "LIST ")) 3106 3155 rc = txsDoList(pPktHdr); 3156 else if (txsIsSameOpcode(pPktHdr, "CPFILE ")) 3157 rc = txsDoCopyFile(pPktHdr); 3107 3158 else if (txsIsSameOpcode(pPktHdr, "PUT FILE")) 3108 3159 rc = txsDoPutFile(pPktHdr, false /*fHasMode*/); … … 3973 4024 return rcExit; 3974 4025 } 3975
Note:
See TracChangeset
for help on using the changeset viewer.