- #include <string.h>
- #include <descrip.h>
- #include <uaidef.h>
- struct itmlst { short length,code;
- long buffer,retlen; };
- int sys$getuai();
- int sys$hash_password();
- void chkpw(char *un,char *pw,int *ok)
- {
- long pwd[2],hpwd[2];
- short salt;
- char encryp;
- struct dsc$descriptor_s undesc,pwdesc;
- struct itmlst items[4] = { {2,UAI$_SALT,&salt,0} , {1,UAI$_ENCRYPT,&encryp,0} ,
- {8,UAI$_PWD,&pwd,0} , {0,0,0,0} };
- undesc.dsc$w_length = strlen(un);
- undesc.dsc$b_dtype = DSC$K_DTYPE_T;
- undesc.dsc$b_class = DSC$K_CLASS_S;
- undesc.dsc$a_pointer = un;
- pwdesc.dsc$w_length = strlen(pw);
- pwdesc.dsc$b_dtype = DSC$K_DTYPE_T;
- pwdesc.dsc$b_class = DSC$K_CLASS_S;
- pwdesc.dsc$a_pointer = pw;
- sys$getuai(0,0,&undesc,&items,0,0,0);
- sys$hash_password(&pwdesc,encryp,salt,&undesc,&hpwd);
- *ok = ((pwd[0]==hpwd[0])&&(pwd[1]==hpwd[1]));
- return;
- }
Raw Paste