[krbdev.mit.edu #6410] MessageBox calls in leashw32.dll cause problems for non-interactive applications

mayer@ntp.org via RT rt at krbdev.mit.edu
Sun Mar 15 13:30:38 EDT 2009


Jeffrey Altman via RT wrote:
> mayer at ntp.isc.org via RT wrote:
>> Jeffrey Altman via RT wrote:
>>> The leashw32.dll is filled with calls to MessageBox().  The assumption
>>> was that if an error occurred within the krb5 library that it should be
>>> displayed to the end user.   The problem is that KFW is no used only for
>>> interactive applications and even when it is the generation of
>>> MessageBoxes from the library as opposed to reporting the errors to the
>>> application and letting the application interact with the user is
>>> (perhaps) a poor choice.
>>>
>>> Attached is a patch that disables all of the MessageBox calls within
>>> leashw32.  It permits USE_MESSAGE_BOX to be specified at compile time in
>>> order to re-enable the MessageBox calls.  
>> It seems to me that a better solution would be to replace calls to
>> MessageBox with a call to a different function and have that function
>> decide how to deal with the message. Since this is a DLL it needs to
>> decide at run-time whether or not it's interactive and what to do with
>> the message.
>>
>> Danny
> 
> Danny:
> 
> I have to ask what benefit the extra work would provide?   Simply
> because the process happens to be running in an interactive environment
> does not mean that a library should throw up arbitrary dialog boxes.
> leashw32.dll was a support library for Leash32.exe and that ticket
> manager relied on the library displaying the errors for help desk
> support.  Leash32.exe is no longer supported and cannot be compiled
> with the latest Visual Studio.  leashw32.dll is simply a support library
> for gssapi32.dll and krb5_32.dll.  In that role I do not believe there
> is any reason to have it display dialogs.
> 
> Jeffrey Altman

I didn't know the context. For this you may be right but as a general
principle I encapsulate these things so that I have a generic function
that can easily redirect the output based on the circumstances. Building
for flexibility is harder than hardcoding.

Danny

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.




More information about the kfwdev mailing list