C00000BE hack-around

Benjamin Kuit bj at mcs.uts.edu.au
Sun Feb 7 07:08:20 GMT 1999

I've had problems with not being able to change my NT password
from the workstation as Samba as the PDC.

With the workstation at SP3, it would claim that I simply
got my password wrong, however with SP4, it would give me the message

 - "Unable to change the password on this account (C00000BE). Please
consult your system administrator."

The cause of this problem seems to be certain unicode strings stored
internally in byte arrays as "a\0b\0" rather than "\0a\0b", so when
trying to be converted to ascii strings, routines like unistrn2 get
it wrong and return "\0\0" instead of "ab".

This effects api_pipe_ntlmssp_verify() where information of user, domain
and workstation is stored in unicode, and in check_oem_password() where
the new password is also in unicode.

My hack-around is confined to unistrn2, basically reading every second
byte in the stream from whichever of the first two bytes has non-zero
values. The diff of source/lib/util_unistr.c included at end of this
email. It is based on the latest cvs.

This (apparently) works quite well for the SP4 workstations,
however I cannot test against SP3 since our NT man went ahead and
added SP4 to them all (grrr).

I dont know if this is the cause of the problem, but I know that the
NT workstations definately have a different byte-order than the server
that samba is running on.

A propper fix would have to go elsewhere.

Diff of source/lib/util_unistr.c

*** ./samba/source/lib/util_unistr.c
--- ./samba/source/lib/util_unistr.c

*** 63,73 ****
        char *lbuf = lbufs[nexti];
        char *p;

        nexti = (nexti+1)%8;
!       for (p = lbuf; *buf && p-lbuf < MAXUNI-2 && len > 0; len--, p++, buf++)
!               *p = *buf;
        *p = 0;
--- 63,76 ----
        char *lbuf = lbufs[nexti];
        char *p;
+       char *b=(char *)buf;     /* Points at the start of buf */
+       if (!*b) b++;            /* If first byte 0, move to next byte */
        nexti = (nexti+1)%8;

!       for (p = lbuf; *b && p-lbuf < MAXUNI-2 && len > 0; len--, p++, b+=2)
!               *p = *b;

        *p = 0;


P.S. Thanks muchly guys, samba works well =)

|      Benjamin (Bj) Kuit       |  Faculty Of Mathematical             |
|      Systems Programmer       |          and Computing Sciences.     |
|      Phone: 02 9514 1841      |  University of Technology, Sydney    |
|      Mobile: 0412 182 972     |  bj at mcs.uts.edu.au                   |

More information about the samba-technical mailing list