summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-03-15 00:49:13 +0000
committerJeremy Allison <jra@samba.org>2001-03-15 00:49:13 +0000
commit4ab6182a0ffdbe92a01dd6533e0862aa8d0f6d83 (patch)
treef2de94060b573c3ec8d38449db373e546ea1db20
parent2335c1d1783cab97419eb13542526411c08be869 (diff)
downloadsamba-4ab6182a0ffdbe92a01dd6533e0862aa8d0f6d83.tar.gz
samba-4ab6182a0ffdbe92a01dd6533e0862aa8d0f6d83.tar.bz2
samba-4ab6182a0ffdbe92a01dd6533e0862aa8d0f6d83.zip
AS/U on a sparc now joins and authenticates against a Samba PDC !
Jeremy. (This used to be commit 28a0bc5f5710aa732db662caa38f9da2138b5db2)
-rw-r--r--source3/include/byteorder.h24
-rw-r--r--source3/include/proto.h2
-rw-r--r--source3/lib/util_unistr.c70
-rw-r--r--source3/nmbd/nmbd_processlogon.c2
-rw-r--r--source3/rpc_server/srv_lsa_nt.c2
-rw-r--r--source3/rpc_server/srv_netlog_nt.c10
-rw-r--r--source3/rpc_server/srv_pipe.c6
-rw-r--r--source3/rpc_server/srv_reg_nt.c4
-rw-r--r--source3/rpc_server/srv_samr_nt.c8
-rw-r--r--source3/rpc_server/srv_srvsvc_nt.c2
10 files changed, 25 insertions, 105 deletions
diff --git a/source3/include/byteorder.h b/source3/include/byteorder.h
index 239d50a66e..5c66d684f6 100644
--- a/source3/include/byteorder.h
+++ b/source3/include/byteorder.h
@@ -175,27 +175,21 @@ it also defines lots of intermediate macros, just ignore those :-)
/* macros for reading / writing arrays */
-#define SMBMACRO(macro,buf,pos,val,len,size) \
-{ int l; for (l = 0; l < (len); l++) (val)[l] = macro((buf), (pos) + (size)*l); }
+#define SMBMACRO(macro1,macro2,buf,pos,val,len,size) \
+{ int l; for (l = 0; l < (len); l++) macro1((val),(size)*l,macro2((buf), (pos) + (size)*l)); }
#define SSMBMACRO(macro,buf,pos,val,len,size) \
{ int l; for (l = 0; l < (len); l++) macro((buf), (pos) + (size)*l, (val)[l]); }
/* reads multiple data from an SMB buffer */
-#define PCVAL(buf,pos,val,len) SMBMACRO(CVAL,buf,pos,val,len,1)
-#define PSVAL(buf,pos,val,len) SMBMACRO(SVAL,buf,pos,val,len,2)
-#define PIVAL(buf,pos,val,len) SMBMACRO(IVAL,buf,pos,val,len,4)
-#define PCVALS(buf,pos,val,len) SMBMACRO(CVALS,buf,pos,val,len,1)
-#define PSVALS(buf,pos,val,len) SMBMACRO(SVALS,buf,pos,val,len,2)
-#define PIVALS(buf,pos,val,len) SMBMACRO(IVALS,buf,pos,val,len,4)
+#define PCVAL(buf,pos,val,len) SMBMACRO(SCVAL,CVAL,buf,pos,val,len,1)
+#define PSVAL(buf,pos,val,len) SMBMACRO(SSVAL,SVAL,buf,pos,val,len,2)
+#define PIVAL(buf,pos,val,len) SMBMACRO(SIVAL,IVAL,buf,pos,val,len,4)
/* stores multiple data in an SMB buffer */
#define PSCVAL(buf,pos,val,len) SSMBMACRO(SCVAL,buf,pos,val,len,1)
#define PSSVAL(buf,pos,val,len) SSMBMACRO(SSVAL,buf,pos,val,len,2)
#define PSIVAL(buf,pos,val,len) SSMBMACRO(SIVAL,buf,pos,val,len,4)
-#define PSCVALS(buf,pos,val,len) SSMBMACRO(SCVALS,buf,pos,val,len,1)
-#define PSSVALS(buf,pos,val,len) SSMBMACRO(SSVALS,buf,pos,val,len,2)
-#define PSIVALS(buf,pos,val,len) SSMBMACRO(SIVALS,buf,pos,val,len,4)
/* now the reverse routines - these are used in nmb packets (mostly) */
@@ -212,16 +206,12 @@ it also defines lots of intermediate macros, just ignore those :-)
#define RSIVALS(buf,pos,val) SIVALS(buf,pos,IREV(val))
/* reads multiple data from an SMB buffer (big-endian) */
-#define RPSVAL(buf,pos,val,len) SMBMACRO(RSVAL,buf,pos,val,len,2)
-#define RPIVAL(buf,pos,val,len) SMBMACRO(RIVAL,buf,pos,val,len,4)
-#define RPSVALS(buf,pos,val,len) SMBMACRO(RSVALS,buf,pos,val,len,2)
-#define RPIVALS(buf,pos,val,len) SMBMACRO(RIVALS,buf,pos,val,len,4)
+#define RPSVAL(buf,pos,val,len) SMBMACRO(SSVAL,RSVAL,buf,pos,val,len,2)
+#define RPIVAL(buf,pos,val,len) SMBMACRO(SIVAL,RIVAL,buf,pos,val,len,4)
/* stores multiple data in an SMB buffer (big-endian) */
#define RPSSVAL(buf,pos,val,len) SSMBMACRO(RSSVAL,buf,pos,val,len,2)
#define RPSIVAL(buf,pos,val,len) SSMBMACRO(RSIVAL,buf,pos,val,len,4)
-#define RPSSVALS(buf,pos,val,len) SSMBMACRO(RSSVALS,buf,pos,val,len,2)
-#define RPSIVALS(buf,pos,val,len) SSMBMACRO(RSIVALS,buf,pos,val,len,4)
#define DBG_RW_PCVAL(charmode,string,depth,base,read,inbuf,outbuf,len) \
{ RW_PCVAL(read,inbuf,outbuf,len) \
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 2b2237c586..d10a414330 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -599,10 +599,8 @@ size_t dos_PutUniCode(char *dst,const char *src, ssize_t len, BOOL null_terminat
void unistr_to_dos(char *dest, const char *src, size_t len);
char *skip_unibuf(char *src, size_t len);
char *dos_unistrn2(uint16 *src, int len);
-char *rpc_unistrn2(uint16 *src, int len, BOOL endian);
char *dos_unistr2(uint16 *src);
char *dos_unistr2_to_str(UNISTR2 *str);
-char *rpc_unistr2_to_str(UNISTR2 *str, BOOL endian);
void ascii_to_unistr(uint16 *dest, const char *src, int maxlen);
void unistr_to_ascii(char *dest, const uint16 *src, int len);
void unistr2_to_ascii(char *dest, const UNISTR2 *str, size_t maxlen);
diff --git a/source3/lib/util_unistr.c b/source3/lib/util_unistr.c
index b1cb9ec410..3ab4bdca9f 100644
--- a/source3/lib/util_unistr.c
+++ b/source3/lib/util_unistr.c
@@ -161,42 +161,6 @@ char *dos_unistrn2(uint16 *src, int len)
return lbuf;
}
-/*******************************************************************
- Return a DOS codepage version of a big or little endian unicode string.
- len is the filename length (ignoring any terminating zero) in uin16
- units. Always null terminates. Endian is 1 if it's big endian.
- Hack alert: uses fixed buffer(s).
-********************************************************************/
-
-char *rpc_unistrn2(uint16 *src, int len, BOOL endian)
-{
- static char lbufs[8][MAXUNI];
- static int nexti;
- char *lbuf = lbufs[nexti];
- char *p;
-
- nexti = (nexti+1)%8;
-
- for (p = lbuf; (len > 0) && (p-lbuf < MAXUNI-3) && *src; len--, src++) {
- uint16 ucs2_val;
- uint16 cp_val;
-
- RW_SVAL(True,endian,src,ucs2_val,0);
-
- cp_val = ucs2_to_doscp[ucs2_val];
-
- if (cp_val < 256)
- *p++ = (char)cp_val;
- else {
- *p++ = (cp_val >> 8) & 0xff;
- *p++ = (cp_val & 0xff);
- }
- }
-
- *p = 0;
- return lbuf;
-}
-
static char lbufs[8][MAXUNI];
static int nexti;
@@ -258,38 +222,6 @@ char *dos_unistr2_to_str(UNISTR2 *str)
}
/*******************************************************************
-Return a DOS codepage version of a big or little-endian unicode string
-********************************************************************/
-
-char *rpc_unistr2_to_str(UNISTR2 *str, BOOL endian)
-{
- char *lbuf = lbufs[nexti];
- char *p;
- uint16 *src = str->buffer;
- int max_size = MIN(MAXUNI-3, str->uni_str_len);
-
- nexti = (nexti+1)%8;
-
- for (p = lbuf; (p-lbuf < max_size) && *src; src++) {
- uint16 ucs2_val;
- uint16 cp_val;
-
- RW_SVAL(True,endian,src,ucs2_val,0);
- cp_val = ucs2_to_doscp[ucs2_val];
-
- if (cp_val < 256)
- *p++ = (char)cp_val;
- else {
- *p++ = (cp_val >> 8) & 0xff;
- *p++ = (cp_val & 0xff);
- }
- }
-
- *p = 0;
- return lbuf;
-}
-
-/*******************************************************************
Put an ASCII string into a UNICODE array (uint16's).
use little-endian ucs2
********************************************************************/
@@ -347,7 +279,7 @@ void unistr_to_ascii(char *dest, const uint16 *src, int len)
}
/*******************************************************************
- Convert a UNISTR2 structure to an ASCII string
+ Convert a (little-endian) UNISTR2 structure to an ASCII string
Warning: this version does DOS codepage.
********************************************************************/
diff --git a/source3/nmbd/nmbd_processlogon.c b/source3/nmbd/nmbd_processlogon.c
index 0da25a313d..5e554ceae2 100644
--- a/source3/nmbd/nmbd_processlogon.c
+++ b/source3/nmbd/nmbd_processlogon.c
@@ -102,7 +102,7 @@ logons are not enabled.\n", inet_ntoa(p->ip) ));
send_mailslot(True, getdc,
outbuf,PTR_DIFF(q,outbuf),
global_myname, 0x0,
- dgram->source_name.name,
+ machine,
dgram->source_name.name_type,
p->ip, *iface_ip(p->ip), p->port);
break;
diff --git a/source3/rpc_server/srv_lsa_nt.c b/source3/rpc_server/srv_lsa_nt.c
index 6e70d8cc87..d4c76fe56f 100644
--- a/source3/rpc_server/srv_lsa_nt.c
+++ b/source3/rpc_server/srv_lsa_nt.c
@@ -128,7 +128,7 @@ static void init_lsa_rid2s(DOM_R_REF *ref, DOM_RID2 *rid2,
/* Split name into domain and user component */
- pstrcpy(full_name, rpc_unistr2_to_str(&name[i], endian));
+ pstrcpy(full_name, dos_unistr2_to_str(&name[i]));
split_domain_name(full_name, dom_name, user);
/* Lookup name */
diff --git a/source3/rpc_server/srv_netlog_nt.c b/source3/rpc_server/srv_netlog_nt.c
index 15ca079238..cfcfac1d1a 100644
--- a/source3/rpc_server/srv_netlog_nt.c
+++ b/source3/rpc_server/srv_netlog_nt.c
@@ -181,8 +181,8 @@ uint32 _net_req_chal(pipes_struct *p, NET_Q_REQ_CHAL *q_u, NET_R_REQ_CHAL *r_u)
if (!get_valid_user_struct(p->vuid))
return NT_STATUS_NO_SUCH_USER;
- fstrcpy(mach_acct, rpc_unistrn2(q_u->uni_logon_clnt.buffer,
- q_u->uni_logon_clnt.uni_str_len, p->endian));
+ fstrcpy(mach_acct, dos_unistrn2(q_u->uni_logon_clnt.buffer,
+ q_u->uni_logon_clnt.uni_str_len));
strlower(mach_acct);
fstrcat(mach_acct, "$");
@@ -280,8 +280,8 @@ uint32 _net_srv_pwset(pipes_struct *p, NET_Q_SRV_PWSET *q_u, NET_R_SRV_PWSET *r_
DEBUG(5,("_net_srv_pwset: %d\n", __LINE__));
- pstrcpy(mach_acct, rpc_unistrn2(q_u->clnt_id.login.uni_acct_name.buffer,
- q_u->clnt_id.login.uni_acct_name.uni_str_len, p->endian));
+ pstrcpy(mach_acct, dos_unistrn2(q_u->clnt_id.login.uni_acct_name.buffer,
+ q_u->clnt_id.login.uni_acct_name.uni_str_len));
DEBUG(3,("Server Password Set Wksta:[%s]\n", mach_acct));
@@ -506,7 +506,7 @@ uint32 _net_sam_logon(pipes_struct *p, NET_Q_SAM_LOGON *q_u, NET_R_SAM_LOGON *r_
/* check username exists */
- pstrcpy(nt_username, rpc_unistrn2(uni_samlogon_user->buffer, uni_samlogon_user->uni_str_len, p->endian));
+ pstrcpy(nt_username, dos_unistrn2(uni_samlogon_user->buffer, uni_samlogon_user->uni_str_len));
DEBUG(3,("User:[%s]\n", nt_username));
diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c
index 16243043d4..bc5b2ab473 100644
--- a/source3/rpc_server/srv_pipe.c
+++ b/source3/rpc_server/srv_pipe.c
@@ -296,9 +296,9 @@ static BOOL api_pipe_ntlmssp_verify(pipes_struct *p, RPC_AUTH_NTLMSSP_RESP *ntlm
*/
if (p->ntlmssp_chal_flags & NTLMSSP_NEGOTIATE_UNICODE) {
- fstrcpy(user_name, rpc_unistrn2((uint16*)ntlmssp_resp->user, ntlmssp_resp->hdr_usr.str_str_len/2, p->endian));
- fstrcpy(domain, rpc_unistrn2((uint16*)ntlmssp_resp->domain, ntlmssp_resp->hdr_domain.str_str_len/2, p->endian));
- fstrcpy(wks, rpc_unistrn2((uint16*)ntlmssp_resp->wks, ntlmssp_resp->hdr_wks.str_str_len/2, p->endian));
+ fstrcpy(user_name, dos_unistrn2((uint16*)ntlmssp_resp->user, ntlmssp_resp->hdr_usr.str_str_len/2));
+ fstrcpy(domain, dos_unistrn2((uint16*)ntlmssp_resp->domain, ntlmssp_resp->hdr_domain.str_str_len/2));
+ fstrcpy(wks, dos_unistrn2((uint16*)ntlmssp_resp->wks, ntlmssp_resp->hdr_wks.str_str_len/2));
} else {
fstrcpy(user_name, ntlmssp_resp->user);
fstrcpy(domain, ntlmssp_resp->domain);
diff --git a/source3/rpc_server/srv_reg_nt.c b/source3/rpc_server/srv_reg_nt.c
index c953fe9d2a..4f941e3e1b 100644
--- a/source3/rpc_server/srv_reg_nt.c
+++ b/source3/rpc_server/srv_reg_nt.c
@@ -85,7 +85,7 @@ uint32 _reg_open_entry(pipes_struct *p, REG_Q_OPEN_ENTRY *q_u, REG_R_OPEN_ENTRY
if (!find_policy_by_hnd(p, &q_u->pol, NULL))
return NT_STATUS_INVALID_HANDLE;
- fstrcpy(name, rpc_unistrn2(q_u->uni_name.buffer, q_u->uni_name.uni_str_len, p->endian));
+ fstrcpy(name, dos_unistrn2(q_u->uni_name.buffer, q_u->uni_name.uni_str_len));
DEBUG(5,("reg_open_entry: %s\n", name));
@@ -129,7 +129,7 @@ uint32 _reg_info(pipes_struct *p, REG_Q_INFO *q_u, REG_R_INFO *r_u)
if (find_policy_by_hnd(p, &q_u->pol, NULL) == -1)
return NT_STATUS_INVALID_HANDLE;
- fstrcpy(name, rpc_unistrn2(q_u->uni_type.buffer, q_u->uni_type.uni_str_len, p->endian));
+ fstrcpy(name, dos_unistrn2(q_u->uni_type.buffer, q_u->uni_type.uni_str_len));
DEBUG(5,("reg_info: checking key: %s\n", name));
diff --git a/source3/rpc_server/srv_samr_nt.c b/source3/rpc_server/srv_samr_nt.c
index dbed5227b0..c3df798c3c 100644
--- a/source3/rpc_server/srv_samr_nt.c
+++ b/source3/rpc_server/srv_samr_nt.c
@@ -1196,7 +1196,7 @@ uint32 _samr_lookup_names(pipes_struct *p, SAMR_Q_LOOKUP_NAMES *q_u, SAMR_R_LOOK
rid [i] = 0xffffffff;
type[i] = SID_NAME_UNKNOWN;
- fstrcpy(name, rpc_unistrn2(q_u->uni_name[i].buffer, q_u->uni_name[i].uni_str_len, p->endian));
+ fstrcpy(name, dos_unistrn2(q_u->uni_name[i].buffer, q_u->uni_name[i].uni_str_len));
if(sid_equal(&pol_sid, &global_sam_sid)) {
DOM_SID sid;
@@ -1227,8 +1227,8 @@ uint32 _samr_chgpasswd_user(pipes_struct *p, SAMR_Q_CHGPASSWD_USER *q_u, SAMR_R_
r_u->status = NT_STATUS_NOPROBLEMO;
- fstrcpy(user_name, rpc_unistrn2(q_u->uni_user_name.buffer, q_u->uni_user_name.uni_str_len, p->endian));
- fstrcpy(wks , rpc_unistrn2(q_u->uni_dest_host.buffer, q_u->uni_dest_host.uni_str_len, p->endian));
+ fstrcpy(user_name, dos_unistrn2(q_u->uni_user_name.buffer, q_u->uni_user_name.uni_str_len));
+ fstrcpy(wks , dos_unistrn2(q_u->uni_dest_host.buffer, q_u->uni_dest_host.uni_str_len));
DEBUG(5,("samr_chgpasswd_user: user: %s wks: %s\n", user_name, wks));
@@ -1709,7 +1709,7 @@ uint32 _api_samr_create_user(pipes_struct *p, SAMR_Q_CREATE_USER *q_u, SAMR_R_CR
reply if the account already exists...
*/
- fstrcpy(mach_acct, rpc_unistrn2(user_account.buffer, user_account.uni_str_len, p->endian));
+ fstrcpy(mach_acct, dos_unistrn2(user_account.buffer, user_account.uni_str_len));
strlower(mach_acct);
become_root();
diff --git a/source3/rpc_server/srv_srvsvc_nt.c b/source3/rpc_server/srv_srvsvc_nt.c
index 01e289866b..6e0043b0bb 100644
--- a/source3/rpc_server/srv_srvsvc_nt.c
+++ b/source3/rpc_server/srv_srvsvc_nt.c
@@ -814,7 +814,7 @@ uint32 _srv_net_share_get_info(pipes_struct *p, SRV_Q_NET_SHARE_GET_INFO *q_u, S
DEBUG(5,("_srv_net_share_get_info: %d\n", __LINE__));
/* Create the list of shares for the response. */
- share_name = rpc_unistr2_to_str(&q_u->uni_share_name, p->endian);
+ share_name = dos_unistr2_to_str(&q_u->uni_share_name);
init_srv_r_net_share_get_info(r_u, share_name, q_u->info_level);
DEBUG(5,("_srv_net_share_get_info: %d\n", __LINE__));