ChangeBinderyObjectSecurity
Changes the security of a bindery object (For cross-platform functionality, see Developing NLMs with Cross-Platform Functions ( NDK: NLM Development Concepts, Tools, and Functions) and call NWChangeObjectSecurity )
#include <\nlm\nit\nwbindry.h>
int ChangeBinderyObjectSecurity (
char *objectName,
WORD objectType,
BYTE newObjectSecurity);
The objectName and objectType parameters must uniquely identify the bindery object and must not contain wildcard characters. The objectName can be from 1 to 48 characters long, including the NULL terminator. Only printable characters can be used. Slashes, backslashes, colons, semicolons, commas, asterisks, and question marks are prohibited.
The newObjectSecurity parameter is actually two nibbles. The low-order nibble determines who can scan for and find the object. The high-order nibble determines who can add properties to the object. The following values are defined for each nibble:
|
0 |
0 0 0 0 |
Anyone |
|
1 |
0 0 0 1 |
Logged |
|
2 |
0 0 1 0 |
Object |
|
3 |
0 0 1 1 |
Supervisor |
|
4 |
0 1 0 0 |
NetWare Operating System |
For example, 0x31 indicates that any user logged in to the server can find the object, but only the supervisor can add a property to the object.
#include <stdio.h>
#include <\nlm\nit\nwbindry.h>
main()
{
int completionCode;
char objName[48];
WORD objType;
BYTE newObjSecurity;
printf ("\n\n");
printf ("Enter Name of Object —> ");
scanf ("%s", objName);
printf ("\nEnter Specifies the type of Object —> ");
scanf ("%d", &objType);
printf ("\nEnter the new READ/WRITE access —> ");
scanf ("%2x", &newObjSecurity);
completionCode = ChangeBinderyObjectSecurity (objName,
objType, newObjSecurity );
if (completionCode)
{
printf ("\n\n\n");
if (completionCode == 150)
printf ("SERVER OUT OF MEMORY\n\n");
if (completionCode == 240)
printf ("WILDCARD NOT ALLOWED\n\n");
if (completionCode == 241)
printf ("INVALID BINDERY SECURITY\n\n");
if (completionCode == 251)
printf ("NO SUCH PROPERTY\n\n");
if (completionCode == 252)
printf ("NO SUCH OBJECT\n\n");
if (completionCode == 254)
printf ("SERVER BINDERY LOCKED\n\n");
if (completionCode == 255)
printf ("BINDERY FAILURE\n\n");
}
else if (completionCode == 0)
printf ("\n\n\nObject Security of %s is %d\n", objName,
newObjSecurity);
else
printf ("completionCode = %d\n", completionCode);
}