iPXE
Functions
netbios.h File Reference

NetBIOS user names. More...

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
const char * netbios_domain (char **username)
 Split NetBIOS [domain\]username into separate domain and username fields.
static void netbios_domain_undo (const char *domain, char *username)
 Restore NetBIOS [domain\]username.

Detailed Description

NetBIOS user names.

Definition in file netbios.h.


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )
const char* netbios_domain ( char **  username)

Split NetBIOS [domain\]username into separate domain and username fields.

Parameters:
usernameNetBIOS [domain\]username string
Return values:
domainDomain portion of string, or NULL if no domain present

This function modifies the original string by removing the separator. The caller may restore the string using netbios_domain_undo().

Definition at line 46 of file netbios.c.

References NULL, and strchr().

Referenced by http_format_ntlm_auth(), and http_ntlm_authenticate().

                                                {
        char *domain_username = *username;
        char *sep;

        /* Find separator, if present */
        sep = strchr ( domain_username, '\\' );
        if ( ! sep )
                return NULL;

        /* Overwrite separator with NUL terminator and update username string */
        *sep = '\0';
        *username = ( sep + 1 );

        return domain_username;
}
static void netbios_domain_undo ( const char *  domain,
char *  username 
) [inline, static]

Restore NetBIOS [domain\]username.

Parameters:
domainNetBIOS domain name
usernameNetBIOS user name

Restore the separator in a NetBIOS [domain\]username as split by netbios_domain().

Definition at line 23 of file netbios.h.

Referenced by http_format_ntlm_auth(), and http_ntlm_authenticate().

                                                                              {

        /* Restore separator, if applicable */
        if ( domain )
                username[-1] = '\\';
}