iPXE
Functions
netbios.c File Reference

NetBIOS user names. More...

#include <stddef.h>
#include <string.h>
#include <ipxe/netbios.h>

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.

Detailed Description

NetBIOS user names.

Definition in file netbios.c.


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;
}