 |
|
|
 |
|
 |
Hi,
I am using MDaemon Server ver 11.
I have connected my (.net) software to mail server. I can create user, update user and also can check mails.
Currenly i am working on software to forward the emails to sms gateway. I have already a system to send sms. (one way only. Mdaemon to sms gateway).
While implementing the process everything works perfect. But the main problem are:
1. But i wish to send message only when user session is inactive or disconnected to the mail server(Mdaemon). Example: User1 is connect to mail server via worldclient. Mail server generates SessionID for User1, which get expire after 15 minutes while user is inactive.
2. Whenever user session is not availabe or inactive at that time only my software will check new message for User1, if new message exist then forward it to the message queue for sms.
Conclusion :
I am searching for function or any dll available via which i can get all active SESSIONID with email address.
As you are working on the project(Mdaemon connectivity) already. So if you can help me, i will feel great and and can provide my code to CodeProject website.
Waiting for your response.
Thanks
Rahul Saud
IT Professional - Lumbini bank Limited
|
|
|
|
 |
|
 |
Hello
I can't answer your question because I never investigated that topic.
Why don't you ask the MDaemon support ?
May be the posting from Member 7915835 below helps you.
Did you check out the Hiwater.mrk file ?
If you find a solution please post it here!
Elmü
|
|
|
|
 |
|
 |
Hello world and good game to this application
But I have a problem, I can't load the MDUser.dll, In the project demo I start the demo.exo but "error 2 loading MDUser.dll", I return this problem, I change the path in the class cHelper : NULL to "D:Program Files\\MDaemon\\App\\MDUser.dll" but no change.
Where you put the DLL file ????
Or if a take the initial MDaemonController project and I use the DLL in a Webservice PRoject I have "error 1 loading MDuser.dll"
error 1 win32 means : invalid function and without changing the code ????
Help me please and sorry for bad English I need to use the MDUser.dll in C#
modified on Monday, May 16, 2011 11:58 AM
|
|
|
|
 |
|
 |
Hello
The most probable reason is that you did not install the MDaemon server on your developer machine.
It writes a path into the Registry if I remember correctly.
Elmü
|
|
|
|
 |
|
 |
I have MDaemon 6.0 so I use his MDUser.dll's
I test more the dll in a new project and I can load the MDUser.dll using "LoadLibrary" same you, but If I use the Demo.exe with next MDUser.dll and MDUserController.dll I have Error 1 : it means invalid function so it's strange.
I have watched your code and it's good, I don't know why I have this problem.
And I must used the API MDaemon to create domain and user etc, so I can't use MDUserCom.dll
When you developed this application what version of MDaemon did you use ? If I remplace your MDUserImports.h and .cpp by mine I have some errors.
modified on Tuesday, May 17, 2011 3:49 AM
|
|
|
|
 |
|
 |
SO now it works ^^
I uninstall MDaemon 6.0 (useless) and I install MDaemon v12 and it works ^^
And now I a question
DO you know how extract the creation date and the last date of use ?
I don't find any function in MDUserImports.cpp .h to do this.
Have you an idea ?
|
|
|
|
 |
|
 |
Hello
Im sorry, but I can't give you support for MDaemon products.
Elmü
|
|
|
|
 |
|
 |
Hello
I cannot help you with this problem.
I have never seen that error.
Please trace with the debugger through the code in MDUserImports.cpp
There you should find what is wrong:
bool LoadMDUserDll(int& Result, char* MDUserDll, bool LoadUsers, bool IgnoreFail, bool PopupErrors)
{
Result = 0;
if (MDUserDll == NULL)
{
char szWorkBuffer[MAX_PATH];
char szAppPath[MAX_PATH+1];
strcpy(szWorkBuffer, "Software\\Alt-N Technologies\\MDaemon");
if ((Result = GetAppPath(szWorkBuffer, szAppPath)) != ERROR_SUCCESS)
{
if (PopupErrors)
{
char Message[256];
sprintf(Message, "Err: %d, Can't open registry for key: %s", Result, szWorkBuffer);
::MessageBox(0, Message, "Fatal Error", 0L);
}
return false;
}
if (szAppPath[0] == '\0')
{
if (PopupErrors)
{
char Message[256];
sprintf(Message, "Err: %d, Can't get AppPath value from key: %s", Result, szWorkBuffer);
::MessageBox(0, Message, "Fatal Error", 0L);
}
}
char szIniPath[256];
if ((Result = GetIniPath(szWorkBuffer, szIniPath)) != ERROR_SUCCESS || szIniPath[0] == '\0')
{
if (PopupErrors)
{
char Message[256];
sprintf(Message, "Err: %d, Can't get IniPath value from key: %s", Result, szWorkBuffer);
::MessageBox(0, Message, "Fatal Error", 0L);
}
return false;
}
char szDllType[16];
GetPrivateProfileString("Advanced", "UserDllType", "", szDllType, sizeof(szDllType), szIniPath);
char szDll[256];
sprintf(szDll, "%s\\MDUser%s.dll", szAppPath, szDllType);
hMDUSER = LoadLibrary(szDll);
}
else
hMDUSER = LoadLibrary(MDUserDll);
if (hMDUSER == NULL)
{
Result = GetLastError();
return false;
}
etc......
|
|
|
|
 |
|
 |
Hello elmu
I find a solution to extract many information of users : mail domain MaxspaceDisk spaceDiskUsed creationDate LastUseDate
[WebMethod]
[SoapHeader("Authentication")]
public string GetAllMailUsers()
{
string MailUsers = "";
ArrayList i_Users = cUser.GetAllUsers();
foreach(string s_User in i_Users){
MailUsers += s_User + ",";
}
return MailUsers;
}
[WebMethod]
[SoapHeader("Authentication")]
public string GetUsersInfo(string MailUser)
{
string InfoUsers = "";
cUser i_User = new cUser();
i_User.GetByEmail(MailUser);
string maildir = i_User.MailDir;
string dateLastConsultation = null;
try
{
dateLastConsultation = IniReadValue("LastAccess", "Date", maildir + "HIWATER.MRK");
}
catch
{
dateLastConsultation = "Inconnu";
}
string dateCreation = IniReadValue("Creation", "Date", maildir + "HIWATER.MRK");
long MaxEspaceDisk = i_User.MaxDiskSpace;
string mailbox = i_User.Mailbox;
string domain = i_User.Domain;
long espaceUtilise = DirectorySize(new System.IO.DirectoryInfo(@maildir));
InfoUsers += MailUser + "," + domain + "," + espaceUtilise + "," + MaxEspaceDisk + "," + dateCreation + "," + dateLastConsultation;
return InfoUsers;
}
public string IniReadValue(string Section, string Key, string path)
{
StringBuilder temp = new StringBuilder(255);
int i = GetPrivateProfileString(Section, Key, "", temp, 255, path);
return temp.ToString();
}
public long DirectorySize(System.IO.DirectoryInfo dirInfo)
{
long total = 0;
foreach (System.IO.FileInfo Fichier in dirInfo.GetFiles())
{
total += Fichier.Length;
}
foreach (System.IO.DirectoryInfo Dossier in dirInfo.GetDirectories())
{
total += DirectorySize(Dossier);
}
return total;
}
so with you have two method to extract information you have just to imbricate the functions directly in C# or in your php or other
I hope this will help other people
|
|
|
|
 |
|
 |
Hello
Thanks for your addition.
I think it will be interesting for many people.
What information is stored in HIWATER.MRK apart from the date?
Elmü
|
|
|
|
 |
|
 |
Hello
Would it be possible that you post your last posting with the correct title
"How to get the date of the last user access"
instead of
"Re: I can't load the MDUser.dll"
as a new posting and delete your latest posting ?
|
|
|
|
 |
|
 |
What I is should do to use GetPrivateProfileString function.
Their is no support for this function in .net.(C#). Please help me how to use it?
|
|
|
|
 |
|
 |
You can call the native Windows API from .NET code via DllImport (PInvoke).
See: PInvoke
Don't forget the
using System.Runtime.InteropServices;
|
|
|
|
 |
|
 |
Hi,
I have a website on my servers' IIS which I'm using in order to add new users. The code of the website works fine from within my Visual Web Developer 2008, but when I try to use it from my website (on the server itself) I get this error:
"System Exception - An unknown error 4294967295 has occurred"
The command which causes this error is: cUser.Add().
I think it has something to do with permissions, but I couldn't find any wrong configuration in my IIS...
Could you please help?
|
|
|
|
 |
|
 |
Hello
4294967295 is -1 and corresponds to MDDLLERR_NOTFOUND.
This error code is undocumented.
Please verify if this code is returned from MD_AddUser()
Check in the stacktrace where the error comes from or trace through the code.
If it really comes from MD_AddUser() this is an undocumented error code. (Bug?)
In this case ask the alt-n support.
If you have a license you have also support.
I have never seen this error.
Can you see anything in the server's log ?
Elmü
|
|
|
|
 |
|
 |
As I wrote in my first post: The error comes from your add() method (also verified it in the stack trace).
I find it hard to believe it's a bug since, as I wrote, this code works fine if I'm running it from within my dev environment, but not when it's deployed on the server.
Also, there's nothing in the event viewer...
|
|
|
|
 |
|
 |
Hello
> As I wrote in my first post: The error comes from your add() method
I know.
Did you read my question thoroughly ??
My question was from what C++ command it comes from!
Did you ever look into the code ?
The error may come from MD_VerifyUserInfo() or from MD_AddUser().
Before asking the support you should know that!
> I find it hard to believe it's a bug since, as I wrote, ...
Returning an undocumented error code is definitely a bug.
May be the underlying reason is a permission problem, but this should be returned via the correct error code.
I cannot help you with this probem. You must investigate more!
Elmü
|
|
|
|
 |
|
 |
I understand what you said, but how can I know where inside the C++ code it fails?
I'm using your wrapper DLL as a reference and I can't access the C++ code inside it (as far as I know).
Could you please explain some more about what you mean so I can check it?
|
|
|
|
 |
|
 |
Hello
OK, so I give you a lesson in debugging:
Option 1:
You can trace with Visual Studio through the C++ code.
Option 2:
If this is not possible you have to add additional code like
DWORD u32_Error = MD_AddUser(&k_User, 0);
char Buffer[1000];
sprintf(Buffer, "MD_AddUser() has returned error code %d", u32_Error);
OutputDebugStringA(Buffer);
A similar code you add after the call to MD_VerifyUserInfo().
This will send a string to the debugger.
Install DebugView from www.sysinternals.com to see the debug output!
Compile the DLL, put it into its place start DebugView and run!
If Visual Studio cannot open the project you did not install the C++ part of Visual Studio.
Are you absolutely sure that there is no error in your code ????
Did you prove that the parameters you pass to AddUser are valid also when the code runs on the website?
How did you prove that ?
I doubt that it is a permission problem.
Obviously the WebUser has very few permissions.
But what my DLL does is to load the MDUser.dll that transmits the command to the MDaemon Service which will finally do the work to add the new user. So you don't need much permissions. Loading a Dll that then opens a Pipe should not be a problem even for the web user.
I think the most probable is an error in your code.
If you are sure that there is a problem in the MDUser.dll ask the support !
Elmü
|
|
|
|
 |
|
 |
Problem solved!
My code, of course, has no errors since I'm using the same code for adding a new user as in your demo project!
As I suspected, it was a permissions problem:
I had to add to the Mdaemon directory the "Local Service" account with the "Full Control" permissions (it appears that the IUSER account is not enough).
Sometimes it's smarter to avoid from getting into unnecessary debugging process due to thinking in the wrong direction (and if you think altn still needs to improve their exceptions catching - you're welcome to report this issue to them).
I'm sorry to prove you were wrong with your false guess of the problem...
Anyway, Thanks a lot for your help!
|
|
|
|
 |
|
 |
I like this solution, because I use MDaemon too and I like it very much; so I'll use your code to automate some operation on my mail server. I have a question for you: do you know how can I know last password change date for my users? Thanks
|
|
|
|
 |
|
 |
Hello
I think you should ask that the MDaemon support.
I can only tell you that my class reflects all the functionality of the C++ MDUser.dll.
So if there is no property with the date of the last password change the most probable is that this information is not accessible.
But your question is the wrong question!
It is nonsense to force the user to change his password frequently.
You do NOT gain more security with that.
If you read books about server security they even discourage from that!
The ONLY thing that you gain is a lot of users who forget their new password.
What you need instead is strong password policy!
That means you must force that a password is mixed of upper- and lowecase letters, symbols and numbers.
A password shorter than 10 characters should be rejected.
You should know that in a so called "dictionary attack" hackers use lists of thousands of frequently used passwords to crack accounts that have an insecure password. If you don't have a strong password policy it is SURE that the hackers will have success because the majority of the users doesn't know how to chose a secure password. So YOU have to force them to use secure passwords!
Please read my detailed article about server security: Webserver Security Check
There I recommend a book and a website where you can learn a lot about server security.
Changing the password frequently is NOT a solution for an insecure server!
What if the user replaces an insecure password with another insecure password ?
You gain nothing with that!
Your users will hate you each time they forgot their new password and the hackers will love you!
If the password is secure there is no reason why a user should change it every 6 months !
Elmü
|
|
|
|
 |