How to dump an "octect string" to a file?

How to dump an "octect string" to a file?

Post by marv » Sat, 04 Nov 2000 06:53:25



Im trying to query AD and SAM via LDAP resp. WinNT for the
AccountExpirationDate - value on a couple of user objects.
The query seems to work fine but when I try to write the value to a
text-file I get an error. Ive found out that the value is an "octet string"
by viewing it from ADSI-Edit. The value is set for a few users and not set
for a few others of them. Im confused if the problem occurs only when the
value isnt set or if there is a general problem to write an "octet
string"-value to a file and that I have to convert it first? I tried that as
well without any luck. Can anyone help me out?
(Im able to write other account properties to the file including user.name,
user.fullName, user.IsAccountDisabled, user.IsAccountLocked and more...)

The crucial part of the script look something like this....

Set user = GetObject("WinNT://domain/username",user)
f.Write user.AccountExpirationDate

 
 
 

How to dump an "octect string" to a file?

Post by jplado » Tue, 07 Nov 2000 04:00:00


AD Octet string is really  a structure composed of two members: a pointer to
a byte (LPBYTE), and a dword. The idea  is that  you have a binary string
but you can't tell how long it is, because unlike character strings, you
can't assume a terminating '\0' exists. that's whythe DWORd is there-  it
tells you how Octet string length in bytes.
In VC, you would get the LPBYTE member into a byte array, and chop it off
using the dword.
then if  you want to copy it you (usually using memcpy()), you know how many
bytes to copy, or write to a file.
I would assume that your file class has no idea how long the string is, and
so any results you get are completely random, sometimes it crashes (have you
looked at your logs for "access violation" messages?), sometimes not.
try and see if you can get the dword  member of the octet string and use it
to write safely to the file. Since I don't have a clue about VB, I can't
help you more, sorry!
johnatan Pladott

Quote:> Im trying to query AD and SAM via LDAP resp. WinNT for the
> AccountExpirationDate - value on a couple of user objects.
> The query seems to work fine but when I try to write the value to a
> text-file I get an error. Ive found out that the value is an "octet
string"
> by viewing it from ADSI-Edit. The value is set for a few users and not set
> for a few others of them. Im confused if the problem occurs only when the
> value isnt set or if there is a general problem to write an "octet
> string"-value to a file and that I have to convert it first? I tried that
as
> well without any luck. Can anyone help me out?
> (Im able to write other account properties to the file including
user.name,
> user.fullName, user.IsAccountDisabled, user.IsAccountLocked and more...)

> The crucial part of the script look something like this....

> Set user = GetObject("WinNT://domain/username",user)
> f.Write user.AccountExpirationDate


 
 
 

How to dump an "octect string" to a file?

Post by marv » Tue, 07 Nov 2000 04:00:00


OK thanks alot, Ill try that....somehow. Ill give it a few hours anyway.
Does anyone know if the vb-command "format" can help me with this prob?
Someone told me I should look at it, I cant seem to find any info about it
though.

Keep posting....

/M

 
 
 

1. Problem:"server string" with "netbios aliases"

Hello ....
my Problem is :
I use different Names for the same Servermaschine (because the
Server has different Serverfunktion like printing, share Disks ...).
So i use (Samba 1.9.17) the smb.conf Variable "netbios alias" but
i can not gif different Text for the alias Server.So is there any one
who can help me or have an Idea ?
        Gottfried Siedenberg
PS
Please contact me also via E-Mail I have some Problemes
to use thes Newsgroup.

/-------------------------------------------------------\
|   Gottfried Siedenberg                                |
\   Max Planck Institut fuer molekulare Physiologie     /
|   Rheinlanddamm 201                                   |
/   44139 Dortmund                                      \
|                                                       |
/   Tel: +49 231 1206 319                               /
|   Fax: +49 231 9023009                                |

/   Online:  Montags - donnerstag  7:30 - 16:00 Uhr     /
\            Freitags              7:30 - 15:00 Uhr     \
|-------------------------------------------------------|

2. SPARCstation 20 onboard SCSI support Differential HDD's?

3. Problems with special characters like ("?","ΓΌ","?","?",aso.)

4. Money 2002 Deluxe Sync Update Won't Install

5. "Client File Operations Postponed" & Stuck in "Verify_Files" Phase

6. ISDN in Chicago?

7. where do installers "place" files so "add remove hardware" can find them?

8. Impersonateloggedonuser

9. Problems with "hide dot files" and "write list" options

10. Fax service is causing a "core dump"!

11. Where to find description of valid "printer driver = XXXX" strings?

12. Samba nmbd "child status changed - core dumped" (2.0.2, Solaris)

13. "dump workgroup on subnet UNICAST_SUBNET:" ?