[Mono-bugs] [Bug 68848][Maj] New - execution of an exe file

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 27 Oct 2004 10:27:53 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by rosier_a@oreka.com.

http://bugzilla.ximian.com/show_bug.cgi?id=68848

--- shadow/68848	2004-10-27 10:27:52.000000000 -0400
+++ shadow/68848.tmp.22389	2004-10-27 10:27:53.000000000 -0400
@@ -0,0 +1,255 @@
+Bug#: 68848
+Product: Mono: Runtime
+Version: unspecified
+OS: All
+OS Details: win2000 et redhat 8.0
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: rosier_a@oreka.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: execution of an exe file
+
+Please fill in this template when reporting a bug, unless you know what 
+you are doing.
+Description of Problem:
+
+
+Steps to reproduce the problem:
+1. i use this code
+
+using System;
+using System.Net;
+using System.Text;
+
+namespace ExchangeSDK.Snippets.CSharp
+{
+   class CreatingAnAppointmentWebDAV
+   {
+      
+      static int Main(string[] args)
+      {
+         // Variables.
+         string strExchSvrName = ""; //nom du serveur exchange
+         string strMailbox = ""; 		 //adresse du destinataire
+			 
+         string strCalendarUri = "";
+         string strApptItem = "";
+         string strDomain = "";	 		//Domaine dureseau
+         string strUserName = "";		// nom de la personne
+         string strPassword = "";
+         string strApptRequest = "";
+         string strMailInfo = "";
+				 string strMailInfoVal = ""; //objet du RDV
+         string strCalInfo = "";
+         string strXMLNSInfo = "";
+         string strHeaderInfo = "";	//entete du fichier 
+				 string strDateDebut = ""; 	//date de 
+début du RDV
+				 string strDateFin = "";	 
+	//date de fin du RDV
+				 string strDescription = "";//description 
+du RDV
+				 string strLocation = "";	
+	//lieu du rendz vous
+				 string strMDP = "";		 	
+	//mot de passe de la connexion
+				 
+         System.Net.HttpWebRequest PROPPATCHRequest = null;
+         System.Net.WebResponse PROPPATCHResponse = null;
+         System.Net.CredentialCache MyCredentialCache = null;
+         byte[] bytes = null; 
+         System.IO.Stream PROPPATCHRequestStream = null;
+
+         try
+         {
+				 
+						 //objet du calendrier
+						 strMailInfoVal = args[0];
+						 //date de début
+				     strDateDebut = args[1];
+						 //date de fin
+						 strDateFin = args[2];
+						 // Description
+						 strDescription = args[3];
+						 //Destinataire
+						 strMailbox = args[4];
+						 //mot de passe
+						 strMDP = args[5];
+						 //localisation
+						 strLocation="";
+						 
+            // Exchange server name;
+            strExchSvrName = "20.18.17.157";
+
+            // Appointment item.
+            strApptItem = "Calendrier"+ strMailInfoVal +".eml";
+
+            // URI of the user's calendar folder.
+            strCalendarUri = "http://" + strExchSvrName + "/exchange/"
+            + strMailbox + "/Calendrier/";
+						
+						//Console.WriteLine
+(strCalendarUri);
+
+            // User name and password of appointment creator.
+            strUserName = strMailbox;
+            strDomain = "domain";
+            strPassword = strMDP;
+
+            // XML namespace info for the WebDAV request.
+            strXMLNSInfo = "xmlns:g=\"DAV:\" "
+            + "xmlns:e=\"http://schemas.microsoft.com/exchange/\" "
+            + "xmlns:mapi=\"http://schemas.microsoft.com/mapi/\" "
+            + "xmlns:mapit=\"http://schemas.microsoft.com/mapi/proptag/\" "
+            + "xmlns:x=\"xml:\" xmlns:cal=\"urn:schemas:calendar:\" "
+            + "xmlns:dt=\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/
+\" "
+            + "xmlns:header=\"urn:schemas:mailheader:\" "
+            + "xmlns:mail=\"urn:schemas:httpmail:\"";
+
+            // Set the appointment item properties.  See the documentation 
+on the properties
+	    			// in the urn:schemas:calendar: for more 
+information.
+            strCalInfo = "<cal:location>"+strLocation+"</cal:location>"
+            + "<cal:dtstart dt:dt=\"dateTime.tz\">"+ strDateDebut 
++"T00:00:00.000Z</cal:dtstart>"
+//            + "<cal:dtend dt:dt=\"dateTime.tz\">"+ strDateFin 
++"T17:30:00.000Z</cal:dtend>"
+            + "<cal:dtend dt:dt=\"dateTime.tz\">"+ strDateFin 
++"T00:00:00.000Z</cal:dtend>"
+            + "<cal:instancetype dt:dt=\"int\">1</cal:instancetype>"
+            + "<cal:busystatus>BUSY</cal:busystatus>"
+            + "<cal:meetingstatus>CONFIRMED</cal:meetingstatus>"
+					
+	+ "<cal:reminderoffset>900</cal:reminderoffset>"
+            + "<cal:alldayevent dt:dt=\"boolean\">1</cal:alldayevent>"
+            + "<cal:responserequested 
+dt:dt=\"boolean\">1</cal:responserequested>";
+
+            // Set the required attendee of the appointment.
+            strHeaderInfo = "<header:to>" + strMailbox + "</header:to>";
+
+            // Set the subject of the appointment.
+            strMailInfo = "<mail:subject>"+ strMailInfoVal 
++"</mail:subject>"
+            + "<mail:htmldescription>"+ strDescription 
++"</mail:htmldescription>";
+
+            // Build the XML body of the PROPPATCH request.
+            strApptRequest = "<?xml version=\"1.0\"?>"
+            + "<g:propertyupdate " + strXMLNSInfo + ">"
+            + "<g:set><g:prop>"
+            + "<g:contentclass>urn:content-
+classes:appointment</g:contentclass>"
+            
++ "<e:outlookmessageclass>IPM.Appointment</e:outlookmessageclass>"
+            + strMailInfo
+            + strCalInfo
+            + strHeaderInfo
+            + "<mapi:finvited dt:dt=\"boolean\">1</mapi:finvited>"
+            + "</g:prop></g:set>"
+            + "</g:propertyupdate>";
+
+            // Create a new CredentialCache object and fill it with the 
+network
+            // credentials required to access the server.
+            MyCredentialCache = new System.Net.CredentialCache();
+            MyCredentialCache.Add( new System.Uri(strCalendarUri),
+                                   "NTLM",
+                                   new System.Net.NetworkCredential
+(strUserName, strPassword, strDomain)
+                                  );
+
+            // Create the HttpWebRequest object.
+            PROPPATCHRequest = (System.Net.HttpWebRequest)
+HttpWebRequest.Create(strCalendarUri + strApptItem);
+
+            // Add the network credentials to the request.
+            PROPPATCHRequest.Credentials = MyCredentialCache;
+
+            // Specify the PROPPATCH method.
+            PROPPATCHRequest.Method = "PROPPATCH";
+
+            // Encode the body using UTF-8.
+            bytes = Encoding.UTF8.GetBytes((string)strApptRequest);
+
+            // Set the content header length.  This must be
+            // done before writing data to the request stream.
+            PROPPATCHRequest.ContentLength = bytes.Length;
+
+            // Get a reference to the request stream.
+            PROPPATCHRequestStream = PROPPATCHRequest.GetRequestStream();
+
+            // Write the message body to the request stream.
+            PROPPATCHRequestStream.Write(bytes, 0, bytes.Length);
+
+            // Close the Stream object to release the connection
+            // for further use.
+            PROPPATCHRequestStream.Close();
+
+            // Set the content type header.
+            PROPPATCHRequest.ContentType = "text/xml";
+
+            // Create the appointment in the Calendar folder of the
+            // user's mailbox.
+            PROPPATCHResponse = (System.Net.HttpWebResponse)
+PROPPATCHRequest.GetResponse();
+
+            // Clean up.
+            PROPPATCHResponse.Close();
+						
+						return(1);
+
+          //  Console.WriteLine("Appointment successfully created.");
+
+         }
+         catch(Exception ex)
+         {
+            // Catch any exceptions. Any error codes from the PROPPATCH
+            // method request on the server will be caught
+            // here, also.
+						
+            Console.WriteLine(ex.Message);
+						return(0);
+         }
+
+      }
+   }
+}
+
+
+2. i compile with mcs : the compilation succeeded
+the file create is test.exe
+
+
+Actual Results:
+ if i run "test.exe" in win2000 -> it's ok
+ if i run "mono test.exe" ->not ok, an exception was catch : request 
+started and the error is :
+Unhandled Exception: System.InvalidOperationException: request started
+in <0x00033> System.Net.HttpWebRequest:CheckRequestStarted ()
+in <0x0000d> System.Net.HttpWebRequest:set_ContentType (string)
+in <0x00635> ExchangeSDK.Snippets.CSharp.CreatingAnAppointmentWebDAV:Main 
+(strin
+g[])
+
+
+
+Expected Results:
+
+
+How often does this happen? 
+
+always
+
+Additional Information:
+
+with an exhange 2003 server