2000-05-09 15:43:00 +04:00
/*
2002-01-30 09:08:46 +03:00
Unix SMB / CIFS implementation .
2000-05-09 15:43:00 +04:00
Winbind daemon for ntdom nss module
Copyright ( C ) Tim Potter 2000
2004-12-18 01:16:30 +03:00
You are free to use this interface definition in any way you see
fit , including without restriction , using this header in your own
products . You do not need to give any attribution .
2000-05-09 15:43:00 +04:00
*/
2005-05-07 19:03:00 +04:00
# ifndef CONST_DISCARD
# define CONST_DISCARD(type, ptr) ((type) ((void *) (ptr)))
# endif
# ifndef CONST_ADD
# define CONST_ADD(type, ptr) ((type) ((const void *) (ptr)))
# endif
2001-09-17 08:52:45 +04:00
# ifndef SAFE_FREE
2005-05-31 17:46:45 +04:00
# define SAFE_FREE(x) do { if(x) {free(x); x=NULL;} } while(0)
2001-09-17 08:52:45 +04:00
# endif
2000-05-09 15:43:00 +04:00
# ifndef _WINBINDD_NTDOM_H
# define _WINBINDD_NTDOM_H
# define WINBINDD_SOCKET_NAME "pipe" /* Name of PF_UNIX socket */
# define WINBINDD_SOCKET_DIR " / tmp / .winbindd" /* Name of PF_UNIX dir */
2003-04-07 11:32:51 +04:00
# define WINBINDD_PRIV_SOCKET_SUBDIR "winbindd_privileged" /* name of subdirectory of lp_lockdir() to hold the 'privileged' pipe */
2000-06-14 13:58:12 +04:00
# define WINBINDD_DOMAIN_ENV "WINBINDD_DOMAIN" /* Environment variables */
# define WINBINDD_DONT_ENV "_NO_WINBINDD"
2000-05-09 15:43:00 +04:00
2002-01-10 14:28:14 +03:00
/* Update this when you change the interface. */
2002-01-11 02:45:29 +03:00
2005-06-09 02:10:34 +04:00
# define WINBIND_INTERFACE_VERSION 11
2002-01-11 02:45:29 +03:00
/* Socket commands */
2002-01-10 14:28:14 +03:00
2000-05-09 15:43:00 +04:00
enum winbindd_cmd {
2000-06-14 13:58:12 +04:00
2002-01-11 02:45:29 +03:00
WINBINDD_INTERFACE_VERSION , /* Always a well known value */
2000-06-14 13:58:12 +04:00
/* Get users and groups */
2002-01-10 09:20:03 +03:00
WINBINDD_GETPWNAM ,
WINBINDD_GETPWUID ,
WINBINDD_GETGRNAM ,
WINBINDD_GETGRGID ,
2000-10-11 09:45:06 +04:00
WINBINDD_GETGROUPS ,
2000-06-14 13:58:12 +04:00
/* Enumerate users and groups */
WINBINDD_SETPWENT ,
WINBINDD_ENDPWENT ,
WINBINDD_GETPWENT ,
WINBINDD_SETGRENT ,
WINBINDD_ENDGRENT ,
WINBINDD_GETGRENT ,
/* PAM authenticate and password change */
WINBINDD_PAM_AUTH ,
2001-11-14 23:02:02 +03:00
WINBINDD_PAM_AUTH_CRAP ,
2000-06-14 13:58:12 +04:00
WINBINDD_PAM_CHAUTHTOK ,
/* List various things */
2001-11-14 23:02:02 +03:00
WINBINDD_LIST_USERS , /* List w/o rid->id mapping */
WINBINDD_LIST_GROUPS , /* Ditto */
2000-06-14 13:58:12 +04:00
WINBINDD_LIST_TRUSTDOM ,
/* SID conversion */
WINBINDD_LOOKUPSID ,
WINBINDD_LOOKUPNAME ,
2001-11-14 23:02:02 +03:00
/* Lookup functions */
2000-06-14 13:58:12 +04:00
WINBINDD_SID_TO_UID ,
WINBINDD_SID_TO_GID ,
WINBINDD_UID_TO_SID ,
WINBINDD_GID_TO_SID ,
2004-04-07 16:43:44 +04:00
WINBINDD_ALLOCATE_RID ,
2005-06-09 02:10:34 +04:00
WINBINDD_ALLOCATE_RID_AND_GID ,
2000-06-14 13:58:12 +04:00
/* Miscellaneous other stuff */
WINBINDD_CHECK_MACHACC , /* Check machine account pw works */
2002-01-10 13:23:54 +03:00
WINBINDD_PING , /* Just tell me winbind is running */
2002-01-10 14:28:14 +03:00
WINBINDD_INFO , /* Various bit of info. Currently just tidbits */
2002-01-26 12:55:38 +03:00
WINBINDD_DOMAIN_NAME , /* The domain this winbind server is a member of (lp_workgroup()) */
2000-06-14 13:58:12 +04:00
2004-01-04 14:51:31 +03:00
WINBINDD_DOMAIN_INFO , /* Most of what we know from
struct winbindd_domain */
2005-06-09 02:10:34 +04:00
WINBINDD_GETDCNAME , /* Issue a GetDCName Request */
2004-01-04 14:51:31 +03:00
2002-01-31 14:49:29 +03:00
WINBINDD_SHOW_SEQUENCE , /* display sequence numbers of domains */
2002-03-29 18:37:39 +03:00
/* WINS commands */
WINBINDD_WINS_BYIP ,
WINBINDD_WINS_BYNAME ,
2002-07-15 14:35:28 +04:00
/* this is like GETGRENT but gives an empty group list */
WINBINDD_GETGRLST ,
2003-01-28 15:07:02 +03:00
WINBINDD_NETBIOS_NAME , /* The netbios name of the server */
2000-06-14 13:58:12 +04:00
2003-04-07 11:32:51 +04:00
/* find the location of our privileged pipe */
2003-03-24 12:54:13 +03:00
WINBINDD_PRIV_PIPE_DIR ,
2003-11-19 11:11:14 +03:00
/* return a list of group sids for a user sid */
2005-06-09 02:10:34 +04:00
WINBINDD_GETUSERSIDS ,
/* Return the domain groups a user is in */
WINBINDD_GETUSERDOMGROUPS ,
/* Initialize connection in a child */
WINBINDD_INIT_CONNECTION ,
/* Blocking calls that are not allowed on the main winbind pipe, only
* between parent and children */
WINBINDD_DUAL_SID2UID ,
WINBINDD_DUAL_SID2GID ,
WINBINDD_DUAL_IDMAPSET ,
/* Wrapper around possibly blocking unix nss calls */
WINBINDD_DUAL_UID2NAME ,
WINBINDD_DUAL_NAME2UID ,
WINBINDD_DUAL_GID2NAME ,
WINBINDD_DUAL_NAME2GID ,
WINBINDD_DUAL_USERINFO ,
WINBINDD_DUAL_GETSIDALIASES ,
2003-11-19 11:11:14 +03:00
2000-06-14 13:58:12 +04:00
WINBINDD_NUM_CMDS
2000-05-09 15:43:00 +04:00
} ;
2003-07-09 20:44:47 +04:00
typedef struct winbindd_pw {
fstring pw_name ;
fstring pw_passwd ;
uid_t pw_uid ;
gid_t pw_gid ;
fstring pw_gecos ;
fstring pw_dir ;
fstring pw_shell ;
} WINBINDD_PW ;
typedef struct winbindd_gr {
fstring gr_name ;
fstring gr_passwd ;
gid_t gr_gid ;
2005-10-18 07:24:00 +04:00
size_t num_gr_mem ;
size_t gr_mem_ofs ; /* offset to group membership */
2003-07-09 20:44:47 +04:00
char * * gr_mem ;
} WINBINDD_GR ;
2003-07-07 09:11:10 +04:00
# define WBFLAG_PAM_INFO3_NDR 0x0001
# define WBFLAG_PAM_INFO3_TEXT 0x0002
2004-04-06 12:11:16 +04:00
# define WBFLAG_PAM_USER_SESSION_KEY 0x0004
2003-07-07 09:11:10 +04:00
# define WBFLAG_PAM_LMKEY 0x0008
# define WBFLAG_PAM_CONTACT_TRUSTDOM 0x0010
# define WBFLAG_QUERY_ONLY 0x0020
2003-07-11 09:33:40 +04:00
# define WBFLAG_ALLOCATE_RID 0x0040
2003-12-30 16:20:39 +03:00
# define WBFLAG_PAM_UNIX_NAME 0x0080
2004-04-01 16:31:50 +04:00
# define WBFLAG_PAM_AFS_TOKEN 0x0100
2004-04-06 20:44:24 +04:00
# define WBFLAG_PAM_NT_STATUS_SQUASH 0x0200
2002-08-17 21:00:51 +04:00
2005-06-09 02:10:34 +04:00
/* This is a flag that can only be sent from parent to child */
# define WBFLAG_IS_PRIVILEGED 0x0400
2005-09-19 22:49:18 +04:00
/* Flag to say this is a winbindd internal send - don't recurse. */
# define WBFLAG_RECURSE 0x0800
2005-06-09 02:10:34 +04:00
2005-09-30 21:13:37 +04:00
# define WINBINDD_MAX_EXTRA_DATA (128*1024)
2000-05-09 15:43:00 +04:00
/* Winbind request structure */
struct winbindd_request {
2002-01-11 02:45:29 +03:00
uint32 length ;
2000-05-09 15:43:00 +04:00
enum winbindd_cmd cmd ; /* Winbindd command to execute */
pid_t pid ; /* pid of calling process */
2003-07-07 09:11:10 +04:00
uint32 flags ; /* flags relavant to a given request */
2003-08-11 02:01:11 +04:00
fstring domain_name ; /* name of domain for which the request applies */
2000-05-09 15:43:00 +04:00
union {
2002-03-29 18:37:39 +03:00
fstring winsreq ; /* WINS request */
2000-06-14 13:58:12 +04:00
fstring username ; /* getpwnam */
fstring groupname ; /* getgrnam */
uid_t uid ; /* getpwuid, uid_to_sid */
gid_t gid ; /* getgrgid, gid_to_sid */
2000-05-09 15:43:00 +04:00
struct {
2002-09-25 19:19:00 +04:00
/* We deliberatedly don't split into domain/user to
avoid having the client know what the separator
character is . */
2000-05-09 15:43:00 +04:00
fstring user ;
fstring pass ;
2004-10-01 07:28:39 +04:00
fstring require_membership_of_sid ;
2000-06-14 13:58:12 +04:00
} auth ; /* pam_winbind auth module */
2001-08-22 06:48:16 +04:00
struct {
2001-09-05 11:55:54 +04:00
unsigned char chal [ 8 ] ;
2005-11-08 09:19:34 +03:00
uint32 logon_parameters ;
2001-08-22 06:48:16 +04:00
fstring user ;
2002-01-10 13:23:54 +03:00
fstring domain ;
2001-08-22 06:48:16 +04:00
fstring lm_resp ;
uint16 lm_resp_len ;
fstring nt_resp ;
uint16 nt_resp_len ;
2002-08-17 21:00:51 +04:00
fstring workstation ;
2004-10-01 07:28:39 +04:00
fstring require_membership_of_sid ;
2001-08-22 06:48:16 +04:00
} auth_crap ;
2000-06-14 13:58:12 +04:00
struct {
fstring user ;
fstring oldpass ;
fstring newpass ;
} chauthtok ; /* pam_winbind passwd module */
fstring sid ; /* lookupsid, sid_to_[ug]id */
2002-01-26 12:55:38 +03:00
struct {
fstring dom_name ; /* lookupname */
fstring name ;
} name ;
2000-06-30 10:48:47 +04:00
uint32 num_entries ; /* getpwent, getgrent */
2003-07-09 20:44:47 +04:00
struct {
fstring username ;
fstring groupname ;
} acct_mgt ;
2005-06-09 02:10:34 +04:00
struct {
BOOL is_primary ;
fstring dcname ;
} init_conn ;
struct {
fstring sid ;
fstring name ;
BOOL alloc ;
} dual_sid2id ;
struct {
int type ;
uid_t uid ;
gid_t gid ;
fstring sid ;
} dual_idmapset ;
2000-05-09 15:43:00 +04:00
} data ;
2005-09-30 21:13:37 +04:00
char * extra_data ;
size_t extra_len ;
2002-12-20 04:25:27 +03:00
char null_term ;
2000-05-09 15:43:00 +04:00
} ;
/* Response values */
enum winbindd_result {
2000-06-14 13:58:12 +04:00
WINBINDD_ERROR ,
2005-06-09 02:10:34 +04:00
WINBINDD_PENDING ,
2000-06-14 13:58:12 +04:00
WINBINDD_OK
2000-05-09 15:43:00 +04:00
} ;
/* Winbind response structure */
struct winbindd_response {
2000-06-14 13:58:12 +04:00
/* Header information */
2000-05-09 15:43:00 +04:00
2002-01-11 02:45:29 +03:00
uint32 length ; /* Length of response */
2000-06-14 13:58:12 +04:00
enum winbindd_result result ; /* Result code */
2000-05-09 15:43:00 +04:00
2000-06-14 13:58:12 +04:00
/* Fixed length return data */
union {
2002-01-10 14:28:14 +03:00
int interface_version ; /* Try to ensure this is always in the same spot... */
2000-06-14 13:58:12 +04:00
2002-03-29 18:37:39 +03:00
fstring winsresp ; /* WINS response */
2000-06-30 10:48:47 +04:00
/* getpwnam, getpwuid */
2000-06-14 13:58:12 +04:00
2003-07-09 20:44:47 +04:00
struct winbindd_pw pw ;
2000-06-14 13:58:12 +04:00
2000-06-30 10:48:47 +04:00
/* getgrnam, getgrgid */
2000-06-14 13:58:12 +04:00
2003-07-09 20:44:47 +04:00
struct winbindd_gr gr ;
2000-06-14 13:58:12 +04:00
2000-06-30 10:48:47 +04:00
uint32 num_entries ; /* getpwent, getgrent */
2001-11-21 11:36:43 +03:00
struct winbindd_sid {
2000-07-05 15:24:26 +04:00
fstring sid ; /* lookupname, [ug]id_to_sid */
int type ;
} sid ;
2001-11-21 11:36:43 +03:00
struct winbindd_name {
2002-01-26 12:55:38 +03:00
fstring dom_name ; /* lookupsid */
fstring name ;
2000-06-14 13:58:12 +04:00
int type ;
} name ;
uid_t uid ; /* sid_to_uid */
gid_t gid ; /* sid_to_gid */
2002-01-10 14:28:14 +03:00
struct winbindd_info {
char winbind_separator ;
fstring samba_version ;
} info ;
2002-01-26 12:55:38 +03:00
fstring domain_name ;
2003-01-28 15:07:02 +03:00
fstring netbios_name ;
2005-06-09 02:10:34 +04:00
fstring dc_name ;
2002-02-05 12:40:36 +03:00
struct auth_reply {
uint32 nt_status ;
fstring nt_status_string ;
fstring error_string ;
int pam_error ;
2004-04-06 12:11:16 +04:00
char user_session_key [ 16 ] ;
2002-08-17 21:00:51 +04:00
char first_8_lm_hash [ 8 ] ;
2002-02-05 12:40:36 +03:00
} auth ;
2004-04-07 16:43:44 +04:00
uint32 rid ; /* create user or group or allocate rid */
2005-06-09 02:10:34 +04:00
struct {
uint32 rid ;
gid_t gid ;
} rid_and_gid ;
2004-01-04 14:51:31 +03:00
struct {
fstring name ;
fstring alt_name ;
fstring sid ;
BOOL native_mode ;
2004-01-08 11:19:18 +03:00
BOOL active_directory ;
2004-01-04 14:51:31 +03:00
BOOL primary ;
uint32 sequence_number ;
} domain_info ;
2005-06-09 02:10:34 +04:00
struct {
fstring acct_name ;
fstring full_name ;
2005-06-29 18:03:53 +04:00
fstring homedir ;
fstring shell ;
2005-06-09 02:10:34 +04:00
uint32 group_rid ;
} user_info ;
2000-06-14 13:58:12 +04:00
} data ;
2000-05-09 15:43:00 +04:00
2000-06-14 13:58:12 +04:00
/* Variable length return data */
2000-05-09 15:43:00 +04:00
2000-06-14 13:58:12 +04:00
void * extra_data ; /* getgrnam, getgrgid, getgrent */
2000-05-09 15:43:00 +04:00
} ;
# endif