
Click above to get retro games delivered to your door ever month!
X-Hacker.org- NetLib for Clipper, Version 6.0 - n_b_password( <cobject>, <ntype>, <cpassword> [, <cnewpass> ] )
[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
N_B_PASSWORD( <cObject>, <nType>, <cPassword> [, <cNewpass> ] )
Parameters
<cObject>
Name of the object.
<nType>
Object type.
<cPassword>
Current password.
<cNewpass>
New password.
Returns
Logical true if password is valid, otherwise false.
If the function returns false, you can call N_ERROR(), which will
return the NetWare error code.
Description
The password specified in <cPassword> must be the same as that used to
log in to the server.
If you have the required authorization level, you can change the
object's password by specifying the current password as the third
parameter and the new password as the fourth.
Note It is not possible under NetWare to read the current value of
a password. N_B_PASSWORD() merely verifies that a password is valid for
the object or, if the currently logged in user has the required access,
changes the password for the object.
Netware object types are listed below.
Value Object type
1 User
2 Group
3 Print queue
4 File server
6 Gateway
7 Print server
38 Remote bridge
Example
// Force user to re-enter password every 30 minutes
N_ONTICK1(30 * 60, 'SECURITY')
.
.
.
PROCEDURE Security
LOCAL cPassword, cOldColor, lOldEsc, lOldCan
// Exit READ if no keypress in 30 seconds
N_ONNOKEY(30, 'ExitProgram')
// Close other exits from READ
lOldEsc = SET(_SET_ESCAPE, .F.)
lOldCan = SETCANCEL(.F.)
// Get the password
TONE(300, 3)
@ 24, 0 SAY 'Please enter your password: '
cOldColor = SETCOLOR('N/N, N/N')
@ 24, 29 GET cPassword PICTURE '@!'
READ
// If password invalid, call exit routine
IF !N_PASSWORD(N_WHOAMI(), 1, cPassword)
ExitProgram()
ENDIF
// Restore old settings
N_ONNOKEY(0)
SET ESCAPE lOldEsc
SETCANCEL(lOldCan)
SETCOLOR(cOldColor)
RETURN
See Also: N_B_PRCREATE()
Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson