2000-05-09 15:43:00 +04:00
/*
Unix SMB / Netbios implementation .
Version 2.0
Winbind daemon for ntdom nss module
Copyright ( C ) Tim Potter 2000
This library is free software ; you can redistribute it and / or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation ; either
version 2 of the License , or ( at your option ) any later version .
This library is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the GNU
Library General Public License for more details .
You should have received a copy of the GNU Library General Public
License along with this library ; if not , write to the
Free Software Foundation , Inc . , 59 Temple Place - Suite 330 ,
Boston , MA 02111 - 1307 , USA .
*/
2001-09-17 08:52:45 +04:00
# ifndef SAFE_FREE
# define SAFE_FREE(x) do { if(x) {free(x); x=NULL;} } while(0)
# 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 */
2000-08-25 04:55:27 +04:00
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
/* Socket commands */
2002-01-10 14:28:14 +03:00
/* Update this when you change the interface. */
# define WINBIND_INTERFACE_VERSION 1
2000-05-09 15:43:00 +04:00
enum winbindd_cmd {
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 ,
/* 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 */
WINBINDD_INTERFACE_VERSION , /* *TRY* to keep this in the same place... */
2000-06-14 13:58:12 +04:00
/* Placeholder for end of cmd list */
WINBINDD_NUM_CMDS
2000-05-09 15:43:00 +04:00
} ;
/* Winbind request structure */
struct winbindd_request {
enum winbindd_cmd cmd ; /* Winbindd command to execute */
pid_t pid ; /* pid of calling process */
union {
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 {
fstring user ;
fstring pass ;
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 ] ;
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 ;
} 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 */
fstring name ; /* lookupname */
2000-06-30 10:48:47 +04:00
uint32 num_entries ; /* getpwent, getgrent */
2000-05-09 15:43:00 +04:00
} data ;
2001-11-14 23:02:02 +03:00
fstring domain ; /* {set,get,end}{pw,gr}ent() */
2000-05-09 15:43:00 +04:00
} ;
/* Response values */
enum winbindd_result {
2000-06-14 13:58:12 +04:00
WINBINDD_ERROR ,
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
2000-06-14 13:58:12 +04:00
int length ; /* Length of response */
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
2000-06-30 10:48:47 +04:00
/* getpwnam, getpwuid */
2000-06-14 13:58:12 +04:00
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 ;
} pw ;
2000-06-30 10:48:47 +04:00
/* getgrnam, getgrgid */
2000-06-14 13:58:12 +04:00
struct winbindd_gr {
fstring gr_name ;
fstring gr_passwd ;
gid_t gr_gid ;
int num_gr_mem ;
2000-08-25 04:55:27 +04:00
int gr_mem_ofs ; /* offset to group membership */
2000-06-14 13:58:12 +04:00
} gr ;
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 {
2000-06-14 13:58:12 +04:00
fstring name ; /* lookupsid */
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 ;
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