Novell is now a part of Micro Focus

Developer Pointers

Articles and Tips: article

01 Feb 1998


Novell Technical Information Documents

All of the Technical Information Documents (TIDs) discussed below are available at the following locations:

  • The Novell Technical Solutions Database on CompuServe (GO NTID)

  • The DeveloperNet Support World Wide Web site (http://devsup.novell.com)

  • The DeveloperNet Support Bulletin Board (801-861-5836)

Admin API Sample to Set Passwords (VB 5)


Author:

RL

Document ID:

TID101435

Date:

11/26/97 9:59 AM

Alert status:

Yellow

Information type:

Issue

Readme for:

GW5XAD01.EXE

Novell product class:

NetWare API

Novell product andversion:

NetWare SDK

Category:

None

Abstract

This sample will allow an administrator to set the password for a GroupWise user.

The sample displays a dialog that allows a user logged in to a server as admin to connect to a GroupWise domain, and then select a post office in the domain. To a change a password, the administrator must then press the GetUsers button, select a user, and then press the ChangePassword button. If the edit box below the Change Password button does not contain a string, then the password will be cleared for that user.

File Information

Self-Extracting File Name: GW5XAD01.EXE


Files Included:

Size

Date

Time

GW5XAD01.TXT

(this file)

SETPASS.VBP

693

10-26-97

1:58 AM

FORMPASS.FRM

5417

10-26-97

1:58 AM

README.TXT

551

10-26-97

1:58 AM

SETPASS.EXE

17408

10-26-97

1:58 AM

GW5XAD01.MSG

525

10-26-97

1:58 AM

Memory Problems When Nonpersistent Threads Use NETDB Functions


Author:

SP

Document ID:

TID101438

Date:

12/4/97 4:52 PM

Alert status:

Yellow

Information type:

Issue

Readme for:

INLMSP01.EXE

Novell product class:

NetWare API

Novell product andversion:

NetWare SDK

Category:

None

Abstract

NLMs that use NETDB calls within nonpersistent threads can cause NETDB to increase memory use over time. NLMs that call in to NETDB functions should not do so from within nonpersistent threads.

Detailed Description

NETDB (version 3.25i) is a library NLM that allocates space for each thread that uses the NETDB. This space is used to store specific information that is reused in subsequent calls by the same thread. NETDB is designed this way to enhance performance for multiple calls. The space is reserved for the entire life of the thread. However, because the NETDB library NLM only detects NLM termination (unload or normal exit of NLM), this space is released as a part of the cleanup triggered by NLM termination, not by individual thread termination.

It is not advisable to create and terminate a separate thread for each name resolution. This will lead to additional allocation for each thread that refers to the NETDB library NLM, and the space will be released only at the termination of the client NLM.

It is advisable to make NETDB calls from one or more threads that persist rather than doing it from a thread that gets terminated immediately. This can be done by creating a persistent thread that wakes up on a semaphore, gets data from global space, and passes the resolved data back to global space for the calling thread to use.

File Information

Self-Extracting File Name: INLMSP01.EXE


Files Included:

Size

Date

Time

INLMSP01.TXT

(this file)

INLMSP01.MSG

197

10-26-97

1:22 AM

Delphi Source To Get and Set Capture Info


Author:

WS

Document ID:

TID101437

Date:

12/3/97 7:04 AM

Alert status:

Yellow

Information type:

Issue

Readme for:

CAPT.EXE

Novell product class:

NetWare API

Novell product andversion:

NetWare SDK

Category:

None

Abstract

The Delphi 16/32-bit sample shows how to do the following:

  • Check if ports are captured

  • Get the capture settings

  • Change capture settings

  • Capture ports

  • Stop capturing ports

Used APIs:

NWDSFreeContext
NWDSMapIDToName
NWDSMapNameToID
NWEndCapture
NWFlushCapture
NWGetCaptureFlags
NWGetFileServerInformation
NWGetObjectID
NWInitUnicodeTables
NWScanObject
NWSetCaptureFlags
NWStartQueueCapture

See the file HOW-TO.DOC on how to use Delphi with the NetWare SDK CDs.

File Information

Self-Extracting File Name: CAPT.EXE


Files Included:

File

Date

Time

CAPT.TXT

(this file)

CAPT.DOF

537

10-26-97

1:13 AM

CAPT.DPR

606

10-26-97

1:13 AM

U_VARS.PAS

191

10-26-97

1:13 AM

U_SRVINF.PAS

1576

10-26-97

1:13 AM

U_SRVINF.DFM

118

10-26-97

1:14 AM

U_SELSRV.PAS

3931

10-26-97

1:14 AM

U_SELSRV.DFM

1104

10-26-97

1:14 AM

U_CAPT.PAS

6926

10-26-97

1:14 AM

U_CAPT.DFM

2648

10-26-97

1:14 AM

U_ABOUT.PAS

488

10-26-97

1:14 AM

CAPT.OPT

279

10-26-97

1:14 AM

U_ABOUT.DFM

744

10-26-97

1:14 AM

CAPT.DSK

5456

10-26-97

1:14 AM

CAPT.MSG

490

10-26-97

1:14 AM

NETWARE.ICO

766

10-26-97

1:14 AM

MAIN.PAS

2391

10-26-97

1:14 AM

MAIN.DFM

923

10-26-97

1:14 AM

HOW-TO.DOC

5018

10-26-97

1:14 AM

CAPT.TXT

3204

10-26-97

1:14 AM

FCT.DOC

347

10-26-97

1:14 AM

DELPHI_U.PAS

12113

10-26-97

1:14 AM

CAPT.RES

876

10-26-97

1:14 AM

ActiveX: Add a User to an NDS Directory via Delphi 3


Author:

HM

Document ID:

TID101433

Date:

11/24/97 8:54 AM

Alert status:

Yellow

Information type:

Issue

Readme for:

XNDS01.EXE

Novell product class:

NetWare API

Novell product andversion:

NetWare SDK

Category:

None

Abstract

Using the new ActiveX directory control, you can add users to your NDS tree. The sample code in this TID uses Delphi 3 to add a user.

Detailed Description

First, you must install the ActiveX components (download for free from the developer support Web site) onto your Win95/NT box. Then follow the readme.txt to install the ActiveX components into Delphi 3.

File Information

Self-Extracting File Name: XNDS01.EXE


Files Included:

Size

Date

Time

XNDS01.TXT

(this file)

ADDUSER.ZIP

156203

10-26-97

1:19 AM

XNDS01.MSG

125

10-26-97

1:19 AM

ReadCnt Demonstrates Reading a Container Audit File and Matching Event Records with User Names


Author:

KB

Document ID:

TID101434

Date:

11/24/97 8:55 AM

Alert status:

Yellow

Information type:

Issue

Readme for:

XAUD4KB1.EXE

Novell product class:

NetWare API

Novell product andversion:

NetWare SDK

Category:

None

Abstract

This sample code, GetFiles, demonstrates opening the audit file, reading records in the audit file, matching the audit file record user ID with users, and unpacking date and time data.

Detailed Description

This sample code, GetFiles, demonstrates opening the audit file, reading records in the audit file, matching the audit file record user ID with users, and unpacking date and time data.

Process Overview

The audit file contains records for each recorded event. All records have header information and event data. The record header information is the same for all container audit records. The event data is specific to the audit event.

All audit records have a user ID and Replica Number. Two audit events, login user and active connection, record the establishment of an active connection and are the means used to associate a user's identity with subsequent user IDs in the audit file. A login user record or active connection record will always precede other records for a user. Knowing this, the information can be saved and used to match user IDs with users. User ID and Replica Number must be used when looking up user names.

Note: The login and active connection records have the same format. Ifauditing is configuredto track user logins, the login record will be found. Active connection records arerecorded in an audit file after the audit file has been reset or if auditing is notconfigured to track logins.

Note: Event 98 'Start audit file' is always the first event in the audit fileand has no userassociated with it. The event data contains the name of the container beingaudited.

File Information

Self-Extracting File Name: XAUD4KB1.EXE


Files Included:

Size

Date

Time

XAUD4KB1.TXT

(this file)

READCNT.C

10473

10-26-97

1:49 AM

READCNT.EXE

83456

10-26-97

1:49 AM

XAUD4KB1.MSG

188

10-26-97

1:49 AM

Increasing the Limitation of FD_SETSIZE from 16 to 256


Author:

EE

Document ID:

TID101439

Date:

12/8/97 5:07 PM

Alert status:

Yellow

Information type:

Issue

Readme for:

DBSDE002.EXE

Novell product class:

NetWare API

Novell product andversion:

NetWare SDK

Category:

None

Abstract

This document discusses how to increase the FD_SETSIZE limitation of 16. Sample code showing how to accomplish this is found at the end of this TID.

Detailed Description

Problem and History

Novell Developer Technical Support reports high activity in porting UNIX applications to NetWare as NetWare Loadable Modules (NLMs), requesting that FD_SETSIZE be increased to as many as 256--asserting that 16 asynchronous connections constitute too small a limit. This limit figures in the server library, NLMLIB.NLM.

Work-Around

There is a way to work around this limitation, notably by launching a new thread for each set of 16 sockets. However, a separate stack must be allocated for each new thread begun.

Impediment to the Obvious Solution

The principal impediment to increasing the value of FD_SETSIZE arbitrarily is one of backward compatibility. One weakness of the sockets interface--which we cannot change--is that function select() unfortunately operates on three fd_sets of a length determined by FD_SETSIZE rather than a length argument. With all existing NLM binaries built with fd_sets containing fd_arrays dimensioned by FD_SETSIZE as 16, nothing can be done to increase FD_SETSIZE in NLMLIB.NLM without compromising memory integrity dramatically because underneath select(), variables of type fd_set are zero-filled to length FD_SETSIZE.

A new call was added to the library, Set_FD_SETSIZE(), that increases, for the calling thread only, the size of the fd_array and hence fd_set for all affected calls made by that thread.

Solution Setting and Availability

The default size of the array passed will remain at 16 to accommodate (and protect from abend) all older binaries. Note that if you wish to code an NLM that will run on all versions of CLIB, you will need to import the new interface dynamically. Sample code to illustrate this is included at the end of this TID.

The solution is visible to the developer in sys/types.h. The following definitions and prototype will appear close to where FD_SETSIZE is defined, as in the following example:

long dyn_fd_array[1];



     typedef struct dyn_fd_set

     {

          dyn_fd_array fds;

     } dyn_fd_set;



     extern size_t Set_FD_SETSIZE( size_t new_fd_setsize ); /* returns most recent size */

There is no need for new versions of any of the functions originally created to support the earlier, compile-time solution because select(), bsd_select(), bsd_fd_set (), bsd_fd_clr (), and bsd_fd_isset() will simply check the calling thread's globals (TCS) for an FD_SETSIZE different from 16 and follow that. It is, therefore, incumbent on the caller that the value passed to Set_FD_SETSIZE() and the actual size of the fd_set passed to the Sockets functions be identical. Failure to remain at parity in these will certainly cause abnormal termination of NetWare.

Impact on the Existing Product

To enable this capability, the new interface must be called. Otherwise, the original limit of 16 remains in force and no fd_set can be smaller than that.

Documentation Issues

Strictly speaking, no interface changes to normal sockets programming concepts result from this implementation. However, the pointer passed to arguments of type fd_set * will need casting (from dyn_fd_set *).

Additional Notes

Header sys/sockio.h is not affected by any of these changes nor by inclusion order. It is not necessary to link with NWPRE.OBJ to get this new functionality; indeed, if the application is to work also under older versions of CLIB.NLM, it must be linked with Prelude.Obj. This also bars it from gaining the new, full ANSI compliance of the new library affecting the behavior of fputs and the scanf- family of functions, as well as from getting the new, more UNIX-like command line redirection. Usually, these issues are of minor or no importance.

Sample Code

The code in Figure 1 tends to differ from what would normally be expected in coding to select(). This implementation has been set up to demonstrate code that would also work with an older version of CLIB.NLM that doesn't support a dynamic FD_SETSIZE. This code has been neither compiled nor tested--it is only provided as a starting point for using the new dynamic FD_SETSIZE functionality. When using new SDK headers like nwadv.h instead of advanced.h to write code that is going to run on older versions of CLIB.NLM, some attention to backward compatibility is necessary. Notably, Prelude.Obj must be used and not the newer NWPRE.OBJ. Other considerations exceed the scope of this document.

Sample code showing how to change FD_SETSIZE

#include        /* whence malloc() */

     #include 

     #include 

     #include 

     #include 



     #include /* used to be advanced.h whence ImportSymbol() */

     #include /* used to be process.h whence GetNLMHandle() */



     #define MY_FD_SETSIZE 256



     /*

     ** If this function exists, then the library supports using more

     ** descriptors than FD_SETSIZE.

     */

     size_t (*Set_FD_SETSIZE)( size_t );



     int MultiSelectFunc( void )

     {

          int numfds, ourNLM;

          size_t newSize, oldSize;

          dyn_fd_set *rfds, *wfds, *exfds;

          struct timeval t;



          ourNLM = GetNLMHandle();



     /*

     ** Instead of using Set_FD_SETSIZE() directly and becoming load-

     ** dependent on this function, we import it dynamically and, if

     ** it is there, know that we can use 256 sockets instead of only

     ** 16. The size change only affects this thread, however. The new

     ** size is set in state information held by this thread's control

     ** structure and used in place of the manifest constant FD_SETSIZE.

     */

          Set_FD_SETSIZE = ImportSymbol(ourNLM, "Set_FD_SETSIZE");



          if (Set_FD_SETSIZE)

               oldSize = (*Set_FD_SETSIZE)(newSize = MY_FD_SETSIZE);

          else

               newSize = oldSize = FD_SETSIZE;



          rdfs = (dyn_fd_set *) malloc(newSize * sizeof(long));

          wdfs = (dyn_fd_set *) malloc(newSize * sizeof(long));

          exdfs = (dyn_fd_set *) malloc(newSize * sizeof(long));



          if (!rdfs || !wfds || !exfds)

               goto ErrorExit;



          /* because FD_ZERO(), anchored to FD_SETSIZE as it is, won't work here!!!!! */

          memset(rdfs, 0, newSize * sizeof(long));

          memset(wdfs, 0, newSize * sizeof(long));

          memset(exdfs, 0, newSize * sizeof(long));



          numfds = 0;



          while (numfds < newSize)

     {

          /* fill the arrays with whatever; FD_SET, FD_ISSET and FD_CLR do work... */

          numfds++;

     }



          t.tv_sec = 10L;

          t.tv_usec = 0L;



          select(numfds, (fd_set *) rfds, (fd_set *) wfds, (fd_set *) exfds, &t);&


          /* etc. */



     ErrorExit :

          if (rdfs)

               free(rdfs);

          if (wfds)

               free(wdfs);

          if (exfds)

               free(exdfs);



          /* we no longer depend on this symbol once unloaded */

          if (Set_FD_SETSIZE)

               UnimportSymbol(ourNLM, "Set_FD_SETSIZE");

     }

File Information

Self-Extracting File Name: DBSDE002.EXE


Files Included:

Size

Date

Time

DBSDE002.TXT

(this file)

DBSDE002.MSG

153

10-26-97

1:56 AM

NWAPPCreateAppObject Fails with APP_ERROR (-608)


Author:

HW

Document ID:

TID101334

Date:

8/18/97 8:41 AM

Alert status:

Yellow

Information type:

Issue

Readme for:

IHWAPDSC.EXE

Novell product class:

NetWare API

Novell product andversion:

NetWare SDK

Category:

None

Abstract

NWAPPCreateAppObject will fail with an APP_ERROR error when attempting to create an object of class "App:Application." The real NDS error is -608, ERR_ILLEGAL_ATTRIBUTE.

Detailed Description

The problem here is that the layout of the classes to support NAM changed from release 1.0 to 1.1 and above. The former had an abstract class "Application," with the specialized classes for the different OSs descending from it. The newer "App:Application" is not derived from "Application" and hence does not inherit any of the attributes.

The problem surfaces when the "Description" attribute is instantiated. This was "App Blurb" with the old classes, and it is "App:Description" for version 1.1+. The SDK always maps this "Description" to the old attribute. Consequently, NWAPPCreateAppObject will fail any attempt to create an "App:Application" object with description with an error -608, which it translates to the generic APP_ERROR return code.

This has been brought to the attention of Novell Engineering and should be fixed in an upcoming release of the NWSDK libraries.

File Information

Self-Extracting File Name: IHWAPDSC.EXE


Files Included:

Size

Date

Time

IHWAPDSC.TXT

(this file)

IHWAPDSC.MSG

172

8-15-97

3:32 PM

Object API, Query Messages/Appointments, (Delphi 3 App)


Author:

HM

Document ID:

TID101432

Date:

11/24/97 8:54 AM

Alert status:

Yellow

Information type:

Issue

Readme for:

GW5XOB44.EXE

Novell product class:

NetWare API

Novell product andversion:

NetWare SDK

Category:

None

Abstract

This sample code demonstrates how to query a GroupWise 5 MessageBox using the Object API and Delphi 3.

File Information

Self-Extracting File Name: GW5XOB44.EXE


Files Included:

Size

Date

Time

GW5XOB44.TXT

(this file)

QUERY.ZIP

179416

10-26-97

1:12 AM

GW5XOB44.MSG

104

10-26-97

1:12 AM

How the New Template Object Uses the Schema


Author:

HW

Document ID:

TID101331

Date:

8/18/97 8:41 AM

Alert status:

Yellow

Information type:

Issue

Readme for:

IHWTMPLT.EXE

Novell product class:

NetWare API

Novell product andversion:

NetWare SDK

Category:

None

Abstract

The NDS schema shipping with intraNetWare 4.11 has a new Template object that can be used to create new user objects. Some of the features are implemented with the following new attributes:

  • Trustees Of New Object

  • New Object's DS Rights

  • New Object's FS Rights

  • Volume Space Restrictions

This TID does not cover all of the attributes. It focuses on the ones that are not used in the obvious manner and thus require some documentation.

Detailed Description

This TID examines the attributes and their usage in order.


Name:

Trustees Of New Object

Syntax:

ACL

Purpose:

Generate a default security template for the new object.

Comment:

This is straightforward, using the ACL syntax to store trustees as if the objectdid already exist. When the object is actually created, the entries are simplycopied to the new object's ACL.

Name:

New Object's DS Rights

Syntax:

ACL

Purpose:

Determine what rights the new object should gain to other objects in thetree.

Comment:

In this case, the ACL syntax is reversed. The protected attribute name storedactually belongs to the target. The name of this target is stored under the subjectname. When the object is created, the creator reads the ACL and grants thenewly created object the stored rights to the target mentioned under subject.This requires the creator to have managed rights to the target as well. Note thatNWAdmin has to read all possible attributes currently defined in the tree, notonly those that are part of the user object being created.

Name:

New Object's FS Rights

Syntax:

Path

Purpose:

Store file system rights to be granted to the new object.

Comment:

The Volume part receives the distinguished name of the target volume. Thephysical path server/volume: is stored in the Path part. Finally, the rights maskis mapped to the name space type. Upon creation, the creator parses the Pathpart and grants the mentioned trustee rights to the new object.

Name:

Volume Space Restrictions

Syntax:

Path

Purpose:

Store restrictions to be applied to the user account.

Comment:

As restrictions are applied per volume, only one part of the Path syntax isactually needed. Again, the volume receives the distinguished name of thevolume object, the Path part has the server/volume: part, and the name spacetype receives the space restriction in KB.When creating the object, the creatorapplies the restriction to the mentioned volume.

File Information

Self-Extracting File Name: IHWTMPLT.EXE


Files Included:

Size

Date

Time

IHWTMPLT.TXT

(this file)

IHWTMPLT.MSG

418

8-15-97

3:32 PM

Invalid Notify Attribute Address


Author:

MM

Document ID:

TID101436

Date:

12/2/97 2:31 PM

Alert status:

Yellow

Information type:

Issue

Readme for:

NWPSPACK.EXE

Novell product class:

NetWare API

Novell product andversion:

NetWare SDK

Category:

None

Abstract

NWPSCfgGetFirstPrinterAttr should return a pointer to a data structure of NWPS_Typed_Name, which returns a null pointer in its second field for a Typed_Name_T data structure for Notify attribute. The null pointer is a bad address for Microsoft library because NWPS library did not include pack on and pack off in their header files. I have reported this problem to be fixed. Please refer to the Detailed Description for a temporary work-around solution.

Detailed Description

The header files for NWPS API did not include packon.h and packoff.h. Those two files are included for turning the pack data structure option on and off for platform independency. Currently, the Microsoft DLL will not work properly for casting a 4-byte pointer for some data structures. The data structure is NWPS_Typed_Name with the second field as a null pointer. The null pointer is supposed to be casted into Typed_Name_T. Using Microsoft compiler, the application will have illegal pointer access if the null pointer is casted into Typed_Name_T.

The Temporary Work-Around for This Problem

Do not cast the NULL pointer returned from NWPSCfgGetFirstPrinterAttr to the Typed_Name_T. Swap the high byte and low byte to get a valid Pointer for Typed_Name_T.

File Information

Self-Extracting File Name: NWPSPACK.EXE


Files Included:

Size

Date

Time

NWPSPACK.TXT

(this file)

NWPSPACK.MSG

450

10-26-97

1:23 AM

NWPSPACK.TXT

1839

10-26-97

1:23 AM

Object API: Send Message, Appointment, Note from Delphi 2.x


Author:

WS

Document ID:

TID101430

Date:

11/20/97 3:35 PM

Alert status:

Yellow

Information type:

Issue

Readme for:

GW5XMAN.EXE

Novell product class:

NetWare API

Novell product andversion:

NetWare SDK

Category:

None

Abstract

This TID is a small sample that shows how to use Delphi to log in to GroupWise and send messages, appointments, and notes.

File Information

Self-Extracting File Name: GW5XMAN.EXE


Files Included:

Size

Date

Time

GW5XMAN.TXT

(this file)

MAIN.PAS

4730

10-26-97

1:44 AM

MAIN.DFM

2359

10-26-97

1:44 AM

GW5XMAN.RES

876

10-26-97

1:45 AM

GW5XMAN.DOF

557

10-26-97

1:45 AM

GW5XMAN.DPR

212

10-26-97

1:45 AM

GW5XMAN.MSG

107

10-26-97

1:45 AM

Corrected Import File for Delphi and SDK 14


Author:

HW

Document ID:

TID101446

Date:

12/15/97 10:30 AM

Alert status:

Yellow

Information type:

Issue

Readme for:

CALMIS14.EXE

Novell product class:

NetWare API

Novell product andversion:

NetWare SDK

Category:

None

Abstract

The shipping calmis32.imp file for Delphi will not support any client running on NT. The application will fail with an error message that it was unable to locate module 'calwin32'. This is due to a missing .DLL extension in the IMP file. The attachment is a fixed version of the IMP file that can be copied to the SDK IMP location.

File Information

Self-Extracting File Name: CALMIS14.EXE


Files Included:

Size

Date

Time

CALMIS14.TXT

(this file)

CALMIS32.IMP

3521

10-26-97

1:01 AM

CALMIS14.MSG

327

10-26-97

1:01 AM

dup() Causing Warning Message on Console


Author:

JB

Document ID:

TID100948

Document revision:

A

Date:

10/10/96 8:44 AM

Alert status:

Yellow

Information type:

Issue

Readme for:

DUPWARN.EXE

Novell product class:

NetWare API

Novell product andversion:

NetWare SDK 1.0e

Category:

Server

Abstract

Usage of dup() causes the modular CLIB to issue a warning message about an unclosed handle upon NLM termination.

Detailed Description

For every successful call to dup(), one warning message is issued to the console upon NLM termination that the associated handle has not been closed properly. This issue is known, but is planned to be fixed only in a future release of the modular CLIB components. These warning messages can be ignored, but one should take care on the number of messages to ensure that all of them are related to this misbehavior of the library.

File Information

Self-Extracting File Name: DUPWARN.EXE


Files Included:

Size

Date

Time

DUPWARN.TXT

(this file)


Disclaimer

The origin of this information may be internal or external to Novell. While Novell makes all reasonable efforts to verify this information, Novell does not make explicit or implied claims to its validity.

© Copyright Micro Focus or one of its affiliates