Solved

Novell Network Login id..how do i get it?

Posted on 1998-11-09
5
376 Views
Last Modified: 2010-04-04
Does anyone know how to get the user-id on a novell network using delphi? Is there a function or way i can do that?
I want to use the user-id in my program.  
Also, is there a way i can find out all the valid user on my novell network? not just the ones that are logged on.
Also, how about email groups, can i identify what they are on a novell network? i'm using groupwise i believe.
thanks a lot!
0
Comment
Question by:waipahu
5 Comments
 
LVL 4

Expert Comment

by:BoRiS
ID: 1346195
waipahu

I just answered that in the SMTP question...

procedure TForm1.Button1Click(Sender: TObject);
var
Name: array [0..80] of char;
Size: Cardinal;
begin
 WNetGetUser('VWV_FS1', Name, Size);
  Edit1.Text := Name;
end;

Read that question for more info...

Later
BoRiS
0
 
LVL 1

Expert Comment

by:ow
ID: 1346196
 Hi waipahu,

how to find out all the valid users on your novell network depends on what NetWare version you use.
If you use NW 3.x, you must scan the NetWare bindery for user informations, if you use NW 4.x, you have to scan the NDS.

For both you need NetWare SDK, at least the Delphi Import Units for NW SDK.
And you must install NetWare Client32, to have access on the NetWare API routines.

WNetGetUser will only return the (Windows-) loginname, it will not help you, to find a NetWare user-id.

regards
  ow
0
 

Author Comment

by:waipahu
ID: 1346197
Thanks...
I have network 3.11 i believe using Client 32.....later will be moving to 4.11.
How will i do it in 3.11?
any where i can get that info?
Thanks...
also...i am still having problem with my SMTP email program.
I installed it on my co-workers computer and the program came up fine.
it connected to our mail server, but then when i tried to send an email it bombed out.
Why does it work on my computer and not his? this is getting to be so hard
for what seems to be a very simple program.
INPRISE where are you when programmers need help....
bye

0
 
LVL 1

Accepted Solution

by:
ow earned 0 total points
ID: 1346198
 Hi waipahu,

the Novell Libraries for Delphi you find at http://developer.novell.com/ndk/delphilib.htm, size is about 1 MB.
There is a good book from Charles Rose ("Programmer's Guide to Netware"), which describes low level functions in assembler and names the according routines in Client SDK format (now it is called NDK).
The following sorce code is out of this book. The user-IDs you are looking for are retrieved in "Reply.ObjectID".
Instead of "NWCalls" you must use "calwin32" now.

(*                                                                   *)
(* UserInfo - Displays all of the bindery properties for each user   *)
(*                                                                   *)
(* by Charles Rose (adapted to Pascal by Wolfgang Schreiber)         *)
(*                                                                   *)

uses WinCrt, WinDOS, NWCalls;

{$R ROSE.RES}

CONST PSET = 2;


VAR  work                 : Array[1..100] of char ;
     cCode                : WORD;
     connHandle           : NWCONN_HANDLE;
     scanObjectReply      : ScanObjectRep;
     scanPropReply        : ScanPropRep;
     readPropReply        : ReadPropValueRep;

     ScanBinderyResult        : WORD;
     ScanPropertyResult        : WORD;
     ReadPropertyResult   : WORD;
     Reg                  : TRegisters;


Function GetType( ObjectType : Word): String;
BEGIN
   Case Swap( ObjectType ) OF
        0: GetType := 'Unknown';
        1: GetType := 'User';
        2: GetType := 'User Group';
        3: GetType := 'Print Queue';
        4: GetType := 'File Server';
          END;
END;

Function GetSecurity( Security : Byte): String;
VAR   lo, hi   : BYTE ;
      Work     : String;
BEGIN
   lo := Security AND $0F;
   hi := Security AND $F0;
   Case( lo ) of
      $00:         Work := 'Anyone Read, ' ;
      $01:         Work := 'Logged Read, ' ;
      $02:         Work := 'Object Read, ' ;
      $03:         Work := 'Supervisor Read, ' ;
      $04:         Work := 'NetWare Read, ' ;
   END;
   Case( hi ) of
      $00:      Work := Work + 'Anyone Write' ;
      $10:      Work := Work + 'Logged Write' ;
      $20:      Work := Work + 'Object Write' ;
      $30:      Work := Work + 'Supervisor Write' ;
      $40:      Work := Work + 'NetWare Write';
   END;
   GetSecurity := Work
END;

Procedure PrintBinderyScanResults( Reply: scanObjectRep );
BEGIN
   WriteLn;
   WriteLn( 'User : ', ArrayToString(Reply.ObjectName));
   WriteLn( 'ID:    ', hex8(Reply.ObjectID));
   WriteLn( 'Bindery Object Type: ', GetType( Reply.ObjectType ) );
   Write(   'Static/Dynamic Flag: ');
   IF Reply.ObjectFlag > 0 THEN WriteLn( 'Dynamic')
                           else WriteLn( 'Static ' );
   WriteLn( 'Object Security    : ', GetSecurity( Reply.ObjectSecurity ) );
END;

Procedure PrintPropertyScanResults( Reply : scanPropRep );
BEGIN
   Write( '   ', ArrayToString(Reply.PropertyName[1]), '  -- ' );
   IF (Reply.PropertyFlags AND 1)>0 THEN Write( '(Dynamic ')
                                    else Write( '(Static ');
   IF (Reply.PropertyFlags AND 2)>0 THEN Write( 'Set  / ')
                                    else Write( 'Item / ');
   WriteLn( GetSecurity( Reply.PropertySecurity ), ')' );
END;

Procedure PrintSetValues( VAR data );
VAR
   objectID    : NWOBJ_ID;
   ObjType     : NWOBJ_TYPE;
   i           : Byte;
   name        : NWObjectName;
   ID          : Array[1..32] of LongInt absolute data;
   result      : Integer;
BEGIN
   for i := 1 to 32 DO
      if ( ID[i]>0 ) THEN BEGIN
         result := NWGetObjectName(connHandle, ID[i], name, ObjType);
         if result =0 THEN
            WriteLn('         ', hex8(ID[i]), ': ', ArrayToString(name) )
         END;
END;

Procedure PrintPropertyValueReadResults( VAR PropertyName;  Reply :     readPropValueRep);
BEGIN
   if ( Reply.PropertyFlags AND PSET )>0
      THEN PrintSetValues( Reply.data )
      else if ( ArrayToString(PropertyName) = 'IDENTIFICATION' ) THEN
                WriteLn('         ', ArrayToString(Reply.data) );
END;


BEGIN
   cCode := NWGetDefaultConnectionID(ConnHandle);
   ShowError(cCode, 'Get Conn ID', TRUE);

   ScanObjectReply.ObjectID    := $FFFFFFFF;
   repeat
      ScanBinderyResult := NWScanObject(connHandle, '*', OT_USER,
                                ScanObjectReply.ObjectID,
                                ScanObjectReply.ObjectName,
                                ScanObjectReply.ObjectType,
                                ScanObjectReply.ObjectHasProperties,
                                ScanObjectReply.ObjectFlag,
                                ScanObjectReply.ObjectSecurity);
      IF ( ScanBinderyResult = 0 ) THEN
         BEGIN
         PrintBinderyScanResults( ScanObjectReply );

         if ( ScanObjectReply.ObjectHasProperties>0 ) THEN
            BEGIN
            WriteLn( '   Properties:' );
            ScanPropReply.SequenceNumber  := $FFFFFFFF;
            repeat
               ScanPropertyResult := NWScanProperty(connHandle,
                              Addr(ScanObjectReply.ObjectName),
                              ScanObjectReply.objectType, '*',
                              ScanPropReply.sequenceNumber,
                              ScanPropReply.propertyName,
                              ScanPropReply.propertyFlags,
                              ScanPropReply.propertySecurity,
                              ScanPropReply.hasValueFlag,
                              ScanPropReply.moreFlag);
               if ( ScanPropertyResult = 0 ) THEN
                  BEGIN
                  PrintPropertyScanResults( ScanPropReply );
                  if ( ScanPropReply.hasValueFlag > 0 ) THEN
                     BEGIN
                     WriteLn( '      Values:' );
                     ReadPropReply.dataSetIndex := 1;

                     Repeat
                        ReadPropertyResult := NWReadPropertyValue(connHandle,
                               Addr(ScanObjectReply.ObjectName),
                               ScanObjectReply.objectType,
                               Addr(ScanPropReply.propertyName),
                               ReadPropReply.dataSetIndex,
                               ReadPropReply.data,
                               ReadPropReply.moreFlag,
                               ReadPropReply.propertyFlags);

                        if ( ReadPropertyResult = 0 ) THEN
                           BEGIN
                           PrintPropertyValueReadResults( ScanPropReply.PropertyName,                                 ReadPropReply );
                           Inc(ReadPropReply.dataSetIndex)
                           END
                           else
                        if (ReadPropertyResult <> $89EC) THEN
                           ShowError(ReadPropertyResult, 'Reading property', TRUE);
                        Until (ReadPropertyResult > 0) or (ReadPropReply.moreFlag = 0);

                     END;
                  END
                  else
               if ( ScanPropertyResult <> $89FB ) THEN
                  ShowError(ScanPropertyResult, 'Scanning property', TRUE);
              until ( ScanPropertyResult > 0 );
              END
           END
         else
             if ( ScanBinderyResult <> $89FC ) THEN
               ShowError(ScanBinderyResult, 'Scanning bindery object', TRUE);
         PressAnyKeyToContinue;
         until (ScanBinderyResult > 0)
END.

You also may subscribe to Novell DeveloperNet (http://developer.novell.com) to get more information.

Hope this helps.
Regards
  ow
0
 

Expert Comment

by:espeterson
ID: 4158201
If this is a Windows machine, I think you can use the following for just about any type of network:

Var   NetUser : String;
        BufLen: DWORD;
        Buffer: PChar;
begin
    // Get the User name
    BufLen := 255;
    GetMem(Buffer, BufLen);
    try
      if GetUserName(Buffer, BufLen) then
         NetUser := String(Buffer)
      else NetUser := 'none';
    Except
    end;

NetUser will be set with your user name.
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

806 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question