diff options
author | Jeremy Allison <jra@samba.org> | 1998-04-09 20:48:48 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 1998-04-09 20:48:48 +0000 |
commit | af80d8e98f2f74939d680c6abc21e3f40b927f31 (patch) | |
tree | fdca9c39f0ce5ad080b57edbbfefb1c315539946 /source3 | |
parent | 9907a58ca63ec4a8c39709da4a275ddf0b6a3aa3 (diff) | |
download | samba-af80d8e98f2f74939d680c6abc21e3f40b927f31.tar.gz samba-af80d8e98f2f74939d680c6abc21e3f40b927f31.tar.bz2 samba-af80d8e98f2f74939d680c6abc21e3f40b927f31.zip |
Makefile, loadparm.c, server.c, smb.h, util.c: Patch from
stn@techfak.uni-kiel.de (Stefan Nehlsen) to get homes from
the NIS+ map.
smbpasswd.c: Tidy up of cli_state structure.
Jeremy.
(This used to be commit fc2295e0f5729585fdb3ee47edb290851d4071c5)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/include/proto.h | 3 | ||||
-rw-r--r-- | source3/include/smb.h | 2 | ||||
-rw-r--r-- | source3/lib/util.c | 57 | ||||
-rw-r--r-- | source3/param/loadparm.c | 4 | ||||
-rw-r--r-- | source3/smbd/server.c | 14 | ||||
-rw-r--r-- | source3/utils/smbpasswd.c | 2 |
6 files changed, 70 insertions, 12 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h index 993cf46486..ad9a36ca62 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -1750,9 +1750,6 @@ int reply_findnclose(char *inbuf,char *outbuf,int length,int bufsize); int reply_transs2(char *inbuf,char *outbuf,int length,int bufsize); int reply_trans2(char *inbuf,char *outbuf,int length,int bufsize); -/*The following definitions come from ubiqx/ubi_dLinkList.c */ - - /*The following definitions come from ufc.c */ char *ufc_crypt(char *key,char *salt); diff --git a/source3/include/smb.h b/source3/include/smb.h index 21bf346c62..33c483d54c 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -887,7 +887,7 @@ struct parm_struct #define smb_base(buf) (((char *)(buf))+4) -#define SUCCESS 0 /* The request was successful. */ +#define SMB_SUCCESS 0 /* The request was successful. */ #define ERRDOS 0x01 /* Error is from the core DOS operating system set. */ #define ERRSRV 0x02 /* Error is generated by the server network file manager.*/ #define ERRHRD 0x03 /* Error is an hardware error. */ diff --git a/source3/lib/util.c b/source3/lib/util.c index 3173d52692..484dfe21bd 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -22,8 +22,12 @@ #include "includes.h" #if (defined(NETGROUP) && defined (AUTOMOUNT)) +#ifdef NISPLUS +#include <rpcsvc/nis.h> +#else #include "rpcsvc/ypclnt.h" #endif +#endif pstring scope = ""; @@ -3811,6 +3815,58 @@ char *client_addr(int fd) *******************************************************************/ #if (defined(NETGROUP) && defined(AUTOMOUNT)) +#ifdef NISPLUS +static char *automount_lookup(char *user_name) +{ + static fstring last_key = ""; + static pstring last_value = ""; + + char *nis_map = (char *)lp_nis_home_map_name(); + + char nis_domain[NIS_MAXNAMELEN + 1]; + char buffer[NIS_MAXATTRVAL + 1]; + nis_result *result; + nis_object *object; + entry_obj *entry; + + strncpy(nis_domain, (char *)nis_local_directory(), NIS_MAXNAMELEN); + nis_domain[NIS_MAXNAMELEN] = '\0'; + + DEBUG(5, ("NIS+ Domain: %s\n", nis_domain)); + + if (strcmp(user_name, last_key)) + { + sprintf(buffer, "[%s=%s]%s.%s", "key", user_name, nis_map, nis_domain); + DEBUG(5, ("NIS+ querystring: %s\n", buffer)); + + if (result = nis_list(buffer, RETURN_RESULT, NULL, NULL)) + { + if (result->status != NIS_SUCCESS) + { + DEBUG(3, ("NIS+ query failed: %s\n", nis_sperrno(result->status))); + fstrcpy(last_key, ""); pstrcpy(last_value, ""); + } + else + { + object = result->objects.objects_val; + if (object->zo_data.zo_type == ENTRY_OBJ) + { + entry = &object->zo_data.objdata_u.en_data; + DEBUG(5, ("NIS+ entry type: %s\n", entry->en_type)); + DEBUG(3, ("NIS+ result: %s\n", entry->en_cols.en_cols_val[1].ec_value.ec_value_val)); + + pstrcpy(last_value, entry->en_cols.en_cols_val[1].ec_value.ec_value_val); + string_sub(last_value, "&", user_name); + fstrcpy(last_key, user_name); + } + } + } + nis_freeresult(result); + } + DEBUG(4, ("NIS+ Lookup: %s resulted in %s\n", user_name, last_value)); + return last_value; +} +#else /* NISPLUS */ static char *automount_lookup(char *user_name) { static fstring last_key = ""; @@ -3857,6 +3913,7 @@ static char *automount_lookup(char *user_name) DEBUG(4, ("YP Lookup: %s resulted in %s\n", user_name, last_value)); return last_value; } +#endif /* NISPLUS */ #endif /******************************************************************* diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 837632788e..da9d2f77a5 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -740,8 +740,12 @@ static void init_globals(void) Globals.bUnixRealname = False; #if (defined(NETGROUP) && defined(AUTOMOUNT)) Globals.bNISHomeMap = False; +#ifdef NISPLUS + string_set(&Globals.szNISHomeMapName, "auto_home.org_dir"); +#else string_set(&Globals.szNISHomeMapName, "auto.home"); #endif +#endif Globals.client_code_page = DEFAULT_CLIENT_CODE_PAGE; Globals.bTimeServer = False; Globals.bBindInterfacesOnly = False; diff --git a/source3/smbd/server.c b/source3/smbd/server.c index d0b0304430..01f9006a42 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -101,7 +101,7 @@ extern fstring remote_machine; extern pstring OriginalDir; /* these can be set by some functions to override the error codes */ -int unix_ERR_class=SUCCESS; +int unix_ERR_class=SMB_SUCCESS; int unix_ERR_code=0; @@ -2303,11 +2303,11 @@ int unix_error_packet(char *inbuf,char *outbuf,int def_class,uint32 def_code,int int ecode=def_code; int i=0; - if (unix_ERR_class != SUCCESS) + if (unix_ERR_class != SMB_SUCCESS) { eclass = unix_ERR_class; ecode = unix_ERR_code; - unix_ERR_class = SUCCESS; + unix_ERR_class = SMB_SUCCESS; unix_ERR_code = 0; } else @@ -4686,12 +4686,12 @@ int chain_reply(char *inbuf,char *outbuf,int size,int bufsize) CVAL(outbuf2,smb_com) = CVAL(inbuf2,smb_com); memcpy(outbuf2+4,inbuf2+4,4); - CVAL(outbuf2,smb_rcls) = SUCCESS; + CVAL(outbuf2,smb_rcls) = SMB_SUCCESS; CVAL(outbuf2,smb_reh) = 0; CVAL(outbuf2,smb_flg) = 0x80 | (CVAL(inbuf2,smb_flg) & 0x8); /* bit 7 set means a reply */ SSVAL(outbuf2,smb_flg2,1); /* say we support long filenames */ - SSVAL(outbuf2,smb_err,SUCCESS); + SSVAL(outbuf2,smb_err,SMB_SUCCESS); SSVAL(outbuf2,smb_tid,SVAL(inbuf2,smb_tid)); SSVAL(outbuf2,smb_pid,SVAL(inbuf2,smb_pid)); SSVAL(outbuf2,smb_uid,SVAL(inbuf2,smb_uid)); @@ -4748,12 +4748,12 @@ int construct_reply(char *inbuf,char *outbuf,int size,int bufsize) set_message(outbuf,0,0,True); memcpy(outbuf+4,inbuf+4,4); - CVAL(outbuf,smb_rcls) = SUCCESS; + CVAL(outbuf,smb_rcls) = SMB_SUCCESS; CVAL(outbuf,smb_reh) = 0; CVAL(outbuf,smb_flg) = 0x80 | (CVAL(inbuf,smb_flg) & 0x8); /* bit 7 set means a reply */ SSVAL(outbuf,smb_flg2,1); /* say we support long filenames */ - SSVAL(outbuf,smb_err,SUCCESS); + SSVAL(outbuf,smb_err,SMB_SUCCESS); SSVAL(outbuf,smb_tid,SVAL(inbuf,smb_tid)); SSVAL(outbuf,smb_pid,SVAL(inbuf,smb_pid)); SSVAL(outbuf,smb_uid,SVAL(inbuf,smb_uid)); diff --git a/source3/utils/smbpasswd.c b/source3/utils/smbpasswd.c index 425308bec6..2433fa1bb4 100644 --- a/source3/utils/smbpasswd.c +++ b/source3/utils/smbpasswd.c @@ -693,7 +693,7 @@ int main(int argc, char **argv) exit(1); } - cli.error = 0; + memset(&cli, '\0', sizeof(struct cli_state)); if (!cli_initialise(&cli) || !cli_connect(&cli, remote_machine, &ip)) { fprintf(stderr, "%s: unable to connect to SMB server on machine %s. Error was : %s.\n", |