Hi,
I want to modify the module
.....\src\WINNT\win9xpanel\WinAfsLoadDlg.cpp  in the
openafs-1.2.2b for giving the possibility to a user to
change the password, but when execute the function
ka_GetAdminToken the program crash!
WinAFSLoad run under win98
There is someone that can say to me like using that
function?

this is my program:

#include "stdafx.h"


#ifdef _MFC_VER
extern "C" {
#endif
#include <direct.h>
#include <afs\param.h>
#include <afs\stds.h>
#include <afs\kautils.h>
#include "cm_config.h"
#include "cmd.h"
#ifdef _MFC_VER
        }
#endif


#include "WinAfsLoad.h"
#include "WinAfsLoadDlg.h"
#include "modver.h"
#include "encript.h"
#include <winreg.h>
#include "change.h"
#include "cregkey.h"
#include "force.h"
#include "retry.h"
#include <Lmcons.h>
#include "settings.h"
#include "afsmsg95.h"
#include "ProgBarDlg.h"
#include "MyFrame.h"
#include "commandsettings.h"



void CWinAfsLoadDlg::OnChangePasswd() 
{
CChgPswdDlg              dlg;
char                     chgpswd_cell[256];
char                     realm[256];
struct ktc_encryptionKey key;
register des_cblock      mitkey;
struct ktc_encryptionKey newkey;
register des_cblock      newmitkey;
struct ktc_token         token;

#define PCCHAR(str)     ((char *)((const char *)str))
#define ADMIN_LIFETIME (KTC_TIME_UNCERTAINTY+1)

#ifdef DEFAULT_MITV4_STRINGTOKEY
    int dess2k = 1;
#elif DEFAULT_AFS_STRINGTOKEY
    int dess2k = 0;
#else
    int dess2k = -1;
#endif
        dlg.m_sNameUser=m_sUsername;

        if (dlg.DoModal()==IDOK)
        {
                if (dlg.m_sNameUser=="")
                {
                        HandleError("You must write the username!");
                        dlg.m_cNameUser.SetFocus();
                }
                else if (dlg.m_sOldPassword=="")
                {
                        HandleError("You must write the old password!");
                        dlg.m_cOldPassword.SetFocus();
                }
                else if (dlg.m_sNewPassword=="")
                {
                        HandleError("You must write the new password!");
                        dlg.m_cNewPassword.SetFocus();
                }
                else if (dlg.m_sNewPassword1=="")
                {
                        HandleError("You must re-write the new password!");
                        dlg.m_cNewPassword1.SetFocus();
                }
                else if (dlg.m_sNewPassword1 != dlg.m_sNewPassword)
                {
                        HandleError("New password - Mismatch!");
                        dlg.m_cNewPassword1.SetFocus();
                }
                else
                {
                        long code = cm_GetRootCellName(chgpswd_cell);
                        if (code < 0)
                                HandleError("Failed to get local cell name");
                        else
                        {
                                code = ka_Init(0);
                                if(code) {
                                        HandleError("Failed to connect to local 
cell");
                                }
 
                                ka_StringToKey (PCCHAR(dlg.m_sOldPassword),
chgpswd_cell, &key);
                                des_string_to_key(PCCHAR(dlg.m_sOldPassword),
&mitkey);
                                ka_StringToKey (PCCHAR(dlg.m_sNewPassword),
chgpswd_cell, &newkey);
                                des_string_to_key(PCCHAR(dlg.m_sNewPassword),
&newmitkey);
                                code = ka_GetAdminToken
(PCCHAR(dlg.m_sNameUser), 0, chgpswd_cell,
                                        &key, ADMIN_LIFETIME, &token, 
/*!new*/0);
                
IN THIS POINT THE PROGRAM CRASH.


                
__________________________________ 
Do you Yahoo!? 
Read only the mail you want - Yahoo! Mail SpamGuard. 
http://promotions.yahoo.com/new_mail 
_______________________________________________
OpenAFS-devel mailing list
[email protected]
https://lists.openafs.org/mailman/listinfo/openafs-devel

Reply via email to