mirror of
https://github.com/samba-team/samba.git
synced 2025-01-26 10:04:02 +03:00
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)
This commit is contained in:
parent
9907a58ca6
commit
af80d8e98f
@ -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);
|
||||
|
@ -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. */
|
||||
|
@ -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
|
||||
|
||||
/*******************************************************************
|
||||
|
@ -740,7 +740,11 @@ 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;
|
||||
|
@ -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));
|
||||
|
@ -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",
|
||||
|
Loading…
x
Reference in New Issue
Block a user