# This patch file was generated by NetBeans IDE
# This patch can be applied using context Tools: Apply Diff Patch action on respective folder.
# It uses platform neutral UTF-8 encoding.
# Above lines and this line are ignored by the patching process.
--- /root/Desktop/googleauth/googleauth.module
+++ /opt/coolstack/apache2/htdocs/drupal5/modules/googleauth/googleauth.module
@@ -112,8 +112,62 @@
 
 function get_the_actual_response($i, $public, $private) {
   $curr = <<<EOF
-<samlp:Response ID="{{RESPONSE_ID}}" IssueInstant="{{ISSUE_INSTANT}}" Version="2.0" Destination="{{DESTINATION}}" InResponseTo="{{REQUEST_ID}}" xmlns="urn:oasis:names:tc:SAML:2.0:assertion" xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments" /><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#{{RSADSA}}-sha1" /><Reference URI=""><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /><DigestValue></DigestValue></Reference></SignedInfo><SignatureValue></SignatureValue><KeyInfo><KeyValue></KeyValue></KeyInfo></Signature><samlp:Status><samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"/></samlp:Status><Assertion ID="{{ASSERTION_ID}}" IssueInstant="{{ISSUE_INSTANT}}" Version="2.0"	xmlns="urn:oasis:names:tc:SAML:2.0:assertion"><Issuer>{{ISSUER_DOMAIN}}</Issuer><Subject><NameID Format="urn:oasis:names:tc:SAML:2.0:nameid-format:emailAddress">{{USERNAME_STRING}}</NameID><SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer"/></Subject><Conditions NotBefore="{{NOT_BEFORE}}" NotOnOrAfter="{{NOT_ON_OR_AFTER}}"></Conditions><AuthnStatement AuthnInstant="{{AUTHN_INSTANT}}"><AuthnContext><AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:Password</AuthnContextClassRef></AuthnContext></AuthnStatement></Assertion></samlp:Response>
+<samlp:Response ID="{{RESPONSE_ID}}" IssueInstant="{{ISSUE_INSTANT}}" Version="2.0" Destination="{{DESTINATION}}" InResponseTo="{{REQUEST_ID}}"
+        xmlns="urn:oasis:names:tc:SAML:2.0:assertion"
+        xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
+        xmlns:xenc="http://www.w3.org/2001/04/xmlenc#">
+    <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
+        <SignedInfo>
+            <CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments" />
+            <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#{{RSADSA}}-sha1" />
+            <Reference URI="">
+                <Transforms>
+                    <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
+                </Transforms>
+                <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
+                <DigestValue></DigestValue>
+            </Reference>
+        </SignedInfo>
+        <SignatureValue></SignatureValue>
+        <KeyInfo>
+            <KeyValue></KeyValue>
+        </KeyInfo>
+    </Signature>
+        <samlp:Status>
+                <samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"/>
+        </samlp:Status>
+        <Assertion ID="{{ASSERTION_ID}}" IssueInstant="{{ISSUE_INSTANT}}" Version="2.0"
+                xmlns="urn:oasis:names:tc:SAML:2.0:assertion">
+                <Issuer>{{ISSUER_DOMAIN}}</Issuer>
+                <Subject>
+                        <NameID
+                                Format="urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress">
+                                {{USERNAME_STRING}}
+                        </NameID>
+                        <SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer">
+                                <SubjectConfirmationData
+                                        Recipient="{{DESTINATION}}"
+                                        NotOnOrAfter="{{NOT_ON_OR_AFTER}}"
+                                        InResponseTo="{{REQUEST_ID}}"/>
+                        </SubjectConfirmation>
+                </Subject>
+                <Conditions NotBefore="{{NOT_BEFORE}}"
+                        NotOnOrAfter="{{NOT_ON_OR_AFTER}}">
+                        <AudienceRestriction>
+                                <Audience>{{DESTINATION}}</Audience>
+                        </AudienceRestriction>
+                </Conditions>
+                <AuthnStatement AuthnInstant="{{AUTHN_INSTANT}}">
+                        <AuthnContext>
+                                <AuthnContextClassRef>
+                                        urn:oasis:names:tc:SAML:2.0:ac:classes:Password
+                                </AuthnContextClassRef>
+                        </AuthnContext>
+                </AuthnStatement>
+        </Assertion>
+</samlp:Response>
 EOF;
+    
   $curr = str_replace('{{USERNAME_STRING}}', $i['user_name'], $curr); 
   $curr = str_replace('{{RESPONSE_ID}}', get_random_id(), $curr);
   $curr = str_replace('{{ISSUE_INSTANT}}', get_wierd_time(0), $curr);
@@ -138,7 +192,8 @@
   $temp_out = tempnam('/var/tmp', 'SIGNED_');
   exec('chmod a+r ' . $temp);
   exec('chmod a+r ' . $temp_out, $trash);
-  $result = exec(variable_get('googleauth_path_to_xmlsec', '/usr/bin/xmlsec1') . ' sign --privkey-pem ' . $private . ' --pubkey-der ' . $public . ' --output ' . $temp_out . ' ' . $temp, $result);
+  $execline = variable_get('googleauth_path_to_xmlsec', '/usr/bin/xmlsec1') . ' sign --privkey-pem ' . $private . ' --pubkey-der ' . $public . ' --output ' . $temp_out . ' ' . $temp;
+  $result = exec($execline, $result);
   unlink($temp);
   $actual_response = file_get_contents($temp_out);
   if (!$actual_response) {
