VirtualBox

Changeset 26148 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Feb 2, 2010 2:24:55 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
57157
Message:

VbglR3/pam_vbox: Added VbglR3CredentialsDestroy(), update on PAM module.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibCredentials.cpp

    r24311 r26148  
    5353 * @returns IPRT status value
    5454 * @param   ppszUser        Receives pointer of allocated user name string.
    55  *                          The returned pointer must be freed using RTStrFree().
     55 *                          The returned pointer must be freed using VbglR3CredentialsDestroy().
    5656 * @param   ppszPassword    Receives pointer of allocated user password string.
    57  *                          The returned pointer must be freed using RTStrFree().
     57 *                          The returned pointer must be freed using VbglR3CredentialsDestroy().
    5858 * @param   ppszDomain      Receives pointer of allocated domain name string.
    59  *                          The returned pointer must be freed using RTStrFree().
     59 *                          The returned pointer must be freed using VbglR3CredentialsDestroy().
    6060 */
    6161VBGLR3DECL(int) VbglR3CredentialsRetrieve(char **ppszUser, char **ppszPassword, char **ppszDomain)
     
    8787}
    8888
     89
     90/**
     91 * Clears and frees the strings
     92 *
     93 * @returns IPRT status value
     94 * @param   pszUser        Receives pointer of the user name string to destroy. 
     95 *                         Optional.
     96 * @param   pszPassword    Receives pointer of the password string to destroy. 
     97 *                         Optional.
     98 * @param   pszDomain      Receives pointer of allocated domain name string.
     99 *                         Optional.
     100 * @param   u8NumPasses    Number of wipe passes. The higher the better (and slower!).
     101 */
     102VBGLR3DECL(void) VbglR3CredentialsDestroy(char *pszUser, char *pszPassword, char *pszDomain, uint8_t u8NumPasses)
     103{
     104        size_t l;
     105       
     106        if (u8NumPasses == 0) /* We at least want to have one wipe pass. */
     107                u8NumPasses = 1;
     108       
     109        /** @todo add some for-loop with randomized content instead of
     110         *        zero'ing out the string only one time. Use u8NumPasses for that. */
     111        if (pszUser)
     112        {
     113                l = strlen(pszUser);
     114                RT_BZERO(pszUser, l);
     115                RTStrFree(pszUser);
     116        }
     117        if (pszPassword)
     118        {
     119                l = strlen(pszPassword);
     120                RT_BZERO(pszPassword, l);
     121                RTStrFree(pszPassword);
     122        }
     123        if (pszUser)
     124        {
     125                l = strlen(pszDomain);
     126                RT_BZERO(pszDomain, l);
     127                RTStrFree(pszDomain);
     128        }
     129}
Note: See TracChangeset for help on using the changeset viewer.

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