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. More...
 
static void netbios_domain_undo (const char *domain, char *username)
 Restore NetBIOS [domain]username. More...
 

Detailed Description

NetBIOS user names.

Definition in file netbios.h.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ netbios_domain()

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.

46  {
47  char *domain_username = *username;
48  char *sep;
49 
50  /* Find separator, if present */
51  sep = strchr ( domain_username, '\\' );
52  if ( ! sep )
53  return NULL;
54 
55  /* Overwrite separator with NUL terminator and update username string */
56  *sep = '\0';
57  *username = ( sep + 1 );
58 
59  return domain_username;
60 }
char * strchr(const char *src, int character)
Find character within a string.
Definition: string.c:271
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321

References NULL, and strchr().

Referenced by http_format_ntlm_auth(), and http_ntlm_authenticate().

◆ netbios_domain_undo()

static void netbios_domain_undo ( const char *  domain,
char *  username 
)
inlinestatic

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.

23  {
24 
25  /* Restore separator, if applicable */
26  if ( domain )
27  username[-1] = '\\';
28 }
struct ntlm_data domain
Domain name.
Definition: ntlm.h:16

References domain.

Referenced by http_format_ntlm_auth(), and http_ntlm_authenticate().