VirtualBox

Changeset 85235 in vbox


Ignore:
Timestamp:
Jul 11, 2020 4:34:10 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
139212
Message:

Main/DHCPServerImpl: Fixed error code mixup in findLeaseByMAC() and corrected a signedness issue with the slot argument for i_vmNameToIdAndValidateSlot and i_vmNameAndSlotToConfig. bugref:9790

Location:
trunk/src/VBox/Main
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/DHCPServerImpl.h

    r82968 r85235  
    107107    HRESULT i_writeDhcpdConfig(const char *pszFilename, uint32_t uMACAddressVersion) RT_NOEXCEPT;
    108108
    109     HRESULT i_vmNameToIdAndValidateSlot(const com::Utf8Str &aVmName, LONG aSlot, com::Guid &idMachine);
    110     HRESULT i_vmNameAndSlotToConfig(const com::Utf8Str &a_strVmName, LONG a_uSlot, bool a_fCreateIfNeeded,
     109    HRESULT i_vmNameToIdAndValidateSlot(const com::Utf8Str &aVmName, ULONG a_uSlot, com::Guid &idMachine);
     110    HRESULT i_vmNameAndSlotToConfig(const com::Utf8Str &a_strVmName, ULONG a_uSlot, bool a_fCreateIfNeeded,
    111111                                    ComObjPtr<DHCPIndividualConfig> &a_rPtrConfig);
    112112    /** @} */
  • trunk/src/VBox/Main/src-server/DHCPServerImpl.cpp

    r82968 r85235  
    582582 * @returns COM status code.
    583583 * @param   aVmName             The VM name or UUID.
    584  * @param   aSlot               The slot.
     584 * @param   a_uSlot             The slot.
    585585 * @param   idMachine           Where to return the VM UUID.
    586586 */
    587 HRESULT DHCPServer::i_vmNameToIdAndValidateSlot(const com::Utf8Str &aVmName, LONG aSlot, com::Guid &idMachine)
    588 {
    589     if ((ULONG)aSlot <= 32)
     587HRESULT DHCPServer::i_vmNameToIdAndValidateSlot(const com::Utf8Str &aVmName, ULONG a_uSlot, com::Guid &idMachine)
     588{
     589    if (a_uSlot <= 32)
    590590    {
    591591        /* Is it a UUID? */
     
    601601        return hrc;
    602602    }
    603     return setError(E_INVALIDARG, tr("NIC slot number (%d) is out of range (0..32)"), aSlot);
     603    return setError(E_INVALIDARG, tr("NIC slot number (%d) is out of range (0..32)"), a_uSlot);
    604604}
    605605
     
    618618 * @note    Caller must not be holding any locks!
    619619 */
    620 HRESULT DHCPServer::i_vmNameAndSlotToConfig(const com::Utf8Str &a_strVmName, LONG a_uSlot, bool a_fCreateIfNeeded,
     620HRESULT DHCPServer::i_vmNameAndSlotToConfig(const com::Utf8Str &a_strVmName, ULONG a_uSlot, bool a_fCreateIfNeeded,
    621621                                            ComObjPtr<DHCPIndividualConfig> &a_rPtrConfig)
    622622{
     
    10811081                        if (   (aState.equals("acked") || aState.equals("offered") || aState.isEmpty())
    10821082                            && secIssued + cSecsToLive < RTTimeSpecGetSeconds(RTTimeNow(&Now)))
    1083                             hrc = aState.assignNoThrow("expired");
     1083                            hrc = RT_SUCCESS(aState.assignNoThrow("expired")) ? S_OK : E_OUTOFMEMORY;
    10841084                        return hrc;
    10851085                    }
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette