Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 414
  • Last Modified:

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

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
waipahu
Asked:
waipahu
1 Solution
 
BoRiSCommented:
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
 
owCommented:
 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
 
waipahuAuthor Commented:
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
 
owCommented:
 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
 
espetersonCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now