Coldfusion 8 Submit Changes does not save Mail Server Settings in CF Administrator - coldfusion-8

I am currently running Coldfusion 8,0,1,195765 on a Windows 2003 SP 2 server over IIS 6.0.
I needed to change one of the Mail Server Settings in the ColdFusion Administrator, but when I clicked Submit Changes, the page appeared to refresh, and the field was reverted.
I made a change to another page to make sure that changes could be made, and sure enough, the change was applied.
There are no errors shown - everything looks normal, aside from the change.
I was able to make my changes programatically, using mail.cfc, and my change did appear in CF Admin.
My concern is that mail functions have been corrupted or compromised - my primary request for the stackoverflow gurus is how can I restore my Mail Server Settings functionality?
My secondary request is How could this have happened?
Thank you for reading my question.

I am having a similar problem with debugging.
Regarding your first question... You can access the administrator api programatically. Here's how you can verify connection and verify what the current settings are:
<cfscript>
/* you must log in first */
adminObj = createObject("component","cfide.adminapi.administrator"); // this assumes default installation
adminObj.login("password"); // enter your cf admin password
mailServerObj = createObject("component","cfide.adminapi.mail");
value = mailServerObj.getMailServers();
</cfscript>
<cfdump var="#value#">
Value is an array of your current mail server settings.
To make a change change the last part of your script to:
mailServerObj = createObject("component","cfide.adminapi.mail");
mailServerObj.setMailServers(
"yourMailServer",
portNumber,
username="yourUsername",
password="yourPassword",
priority="yourServerPriority");
value = mailServerObj.getMailServers();
The only required value is the entry for yourMailServer. Also, the optional value, portNumber, must be numeric.
Check out http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=basiconfig_37.html for the Adobe documentation for using the Administrator API.
You can also see a complete listing of the Administrator API CFC and their respective functions, check out http://www.cfexecute.com/admin-api-documentation/

Related

How to prevent error message after custom UI in Sitecore

I've built a content editor XML UI element. I launch it via a command with the code
string url = Sitecore.UIUtil.GetUri("control:CloneToMarkets") + "&id=" + HttpUtility.UrlEncode(id) + "&path=" + HttpUtility.UrlEncode(path) + "&database=" + HttpUtility.UrlEncode(database);
Context.ClientPage.ClientResponse.ShowModalDialog(url, "400px", "700px", string.Empty, true);
In my DialogForm class I'm overriding OnLoad() and OnOK(). With on load I'm invoking its base method at the start of the class, and OnOk ends with the base method.
If I "ok", "cancel" or "X" on the custom DialogForm I get this error:
My dialog works fine, and completes its purpose, I'm just getting this error afterwards. Does anyone know what causes this?
I believe that you experience a known problem when Sitecore Client users get mistakenly categorised as robots.
Usually, it happens when Sitecore Analytics is enabled and users do not visit the site front-end before logging into the Sitecore Client. In this situation, the current session may be mistakenly identified as a robot visit and will cause the admin session expiration as Sitecore Analytics reduces session timeout for robot visits aiming to minimise the server resources utilisation.
So, make sure that Sitecore.Analytics.Tracking.RobotDetection.config is disabled on your CM instance and also make the following changes in web.config:
In system.web/httpModules node, name="MediaRequestSessionModule" change the following line from
"Sitecore.Analytics.RobotDetection.Media.MediaRequestSessionModule, Sitecore.Analytics.RobotDetection"
to "Sitecore.Analytics.Media.MediaRequestSessionModule, Sitecore.Analytics".
In system.webServer/modules node, name="MediaRequestSessionModule" change the following line from
"Sitecore.Analytics.RobotDetection.Media.MediaRequestSessionModule, Sitecore.Analytics.RobotDetection"
to "Sitecore.Analytics.Media.MediaRequestSessionModule, Sitecore.Analytics".
Also, take a look at similar posts here:
Your session may have been lost due to a time-out or a server failure. in Sitecore 8.1
https://sitecore.stackexchange.com/questions/6383/can-sitecore-be-customized-to-auto-save-pages-including-the-rich-text-editor

ColdFusion Application.cfc onRequestStart Session scope

I have an application written in ColdFusion that allows users to log in. My login page is in the root directory in a sub-directory called "login". During the login process, the system checks the username and password against my database, and assuming they are legit, it sets a Session variable of "Session.LOGIN_ID". At the bottom of my login script, I can print the login_id to the browser without any problem. However, the last part of my login script is to redirect the user to the main home page, which is located in the root directory in a sub-directory called "main", and once in awhile the page fails to load and rather directs the user back to the login screen with a message stating that their session has ended due to inactivity.
I have a Application.cfc file defined in the "main" folder, with a onRequestStart method defined that checks for the Session.LOGIN_ID being defined. If it is not, it redirects the user back to the login page and shows the message that their session has ended due to inactivity.
My question is, why does my session variable not present in the onRequestStart method? It's strange because if I clear my browser cache and login, I'm able to log in without any problem.
Does this make sense to anyone? Any suggestions as to what I could look for that could be causing this problem? I tried to dump the session vars using cfdump var=#session# from within the onRequestStart method and CF throws and error stating that SESSION is undefined.
UPDATE
In response to Adam's request, there are not multiple domains involved. Also, no switching from HTTP to HTTPS. The login page however is not bound by the Application.cfc because the login page is located in my "login" folder. The Application.cfc file is located in the "main" folder, along with the other components of my application. As far as the screen shot of the cfdump, I don't want to offend anyone but I can't really post the screen shot due to the fact that it contains information pertaining the site and I'm not authorized to post such information. I can say that when I try to do a cfdump of the session scope, it DOES show a few items in the list such as cfid, tokenid etc. However the session.login_ID is not present.
UPDATE
Okay, so taking the suggestion from Frank I have the onRequestStart method set up so that it sends me an email with a dump of the session and cgi scope. I found the following. In the Session dump, the cfid is equal to 4830, and the cftoken starts with b8e0d5... However, in the CGI dump, under HTTP_COOKIE, the value says CFID=4609; CFTOKEN=dd15bc0.... Are they supposed to match?
For me, the situation was resolved by enabling J2EE sessions variables from within CF Administrator. See related post here https://forums.adobe.com/thread/1058200
This is a formatted comment in response to, "I just noticed that the items didnt match in the dump and figured I'd mention it in case they SHOULD match".
Whether or not they should match is up to the programmer, not us on StackOverflow. However, you debug this sort of things as follows.
if(actual result == expected result)
output 'yes'
else
output 'no' and the actual result and the expected result

Override mail settings in application for dev server environments

I am currently in the finishing stages of building an application and have asked the user group to perform production-level usage testing on the application. My application is a makeshift order management system that sends an email to a customer when an order is saved that includes an invoice.
I ran into a problem yesterday when I was doing some testing; this environment currently contains production-quality data, including old customer records. I processed a few orders and forgot about the functionality, and the customer who I did the orders for received emails saying the order is complete. Good that it worked, bad that it lead to this confusion.
The action I would prefer would be to set something somewhere within the application that forces all emails, regardless of the to recipient, to be sent to a specific address, though I would settle for simply being able to turn it off for this application alone. Turning it off on the server level is available not a preferred option due to the need to perform testing on other applications that process email, but are not populated with production-quality data.
Are there any specific flags or code I can use to override server settings in the application to only send email to a certain address based on how we identify our environment, or to not send email altogether?
Reference this page:
http://cookbooks.adobe.com/post_How_can_I_use_Application_level_SMTP_Server_Settin-16469.html
For testing purposes you could set the SMTP server to a non existant IP address. The cfmail routine will still work and coldfusion will move it to an undeliverable folder.
You could add <cfif> statements around it to determine if your on a production URL or dev URL so that it uses the right server while on the production server, or uses the "fake" server while on your development server. OR while on the production server, have an on/off variable that you could use to test emails through your smtp server or shut off emails and route them to the fake SMTP server.
If your on version 8.0 or older, you can setup an application level variable for your mail server and modify your cfmail tags to reference:
<cfmail server="#application.mailserver#" to="" from="" subject="">
This solution presumes you use the same mail server but just want to swap emails to a test address (perhaps yours, so you can see the result). It also presumes your live server name resolves to something that has 'www.something.somethong.' and your dev/test/qa etc servers do not.
In your Application cfc onApplicationStart() try this:
<cfscript>
if(listFirst(CGI.SERVER_NAME,'.') != 'www') {
Application.szEmailToTestEnv = 'test#somewhere.com'; // Use your test email here
}
</cfscript>
Then where you send the email have a bit of logic infront of your mail param such that:
<cfscript>
if(isDefined('Application.szEmailToTestEnv') && len(Application.szEmailToTestEnv)) {
Variables.szEmailTo = Application.szEmailToTestEnv;
} else Variables.szEmailTo = Variables.qCustomerEmail;
</cfscript>
And then in your cfmail:
<cfmail to="#Variables.szEmailTo#"....
Adjust scopes and variable names and value as necessary.
Essentially, any 'site' (say dev.yoursite.com) that is not your live site will then use the test email you set at app startup to send the email and live will continue to use the correct customer email with no code changes between your live and test code.

Login error to Sharepoint 2013 repository using openCMIS Workbench

using the OpenCMIS Workbench 0.8.0, I can load the sharepoint 2013 (GA) repositories fine but get the following error when I try to login to one of the repositories such as Documents:
"Invalid Argument: One or more of the input parameters to the service method is missing or invalid"
Found a blog with some instructions but those didn't work for me:
http://dhartford.blogspot.com/2013/01/sharepoint-2013-w-apache-chemistry-cmis.html?showComment=1359398536275#c6910049622927723676
Note: Here is the service url format that I am using:
http://myserver.xxx.com/MYSITE/cmis/_vti_bin/cmis/rest?getRepositories
Does anybody know what the problem is?
Here is the stack trace from Workbench:
> 11:05:17 DEBUG ncmis.client.bindings.spi.http.HttpUtils: GET http://MYServer/_vti_bin/cmis/rest/f8134afe-176a-4c48-9fd2-a9f97e5dc91d?getTypeDefinition&typeId=cmis%3Adocument
> 11:05:17 TRACE ncmis.client.bindings.spi.http.HttpUtils: GET http://MYServer/_vti_bin/cmis/rest/f8134afe-176a-4c48-9fd2-a9f97e5dc91d?getTypeDefinition&typeId=cmis%3Adocument > Headers: {null=[HTTP/1.1 400 One or more of the input parameters to the service method is missing or invalid.], Server=[Microsoft-IIS/7.5], SPRequestDuration=[124], SPIisLatency=[27], X-FRAME-OPTIONS=[SAMEORIGIN], Content-Type=[plain/text; charset=utf-8], Date=[Wed, 30 Jan 2013 19:05:02 GMT], X-SharePointHealthScore=[1], Cache-Control=[private], X-Content-Type-Options=[nosniff], X-Powered-By=[ASP.NET], X-MS-InvokeApp=[1; RequireReadOnly], request-id=[5ef0f99b-24ec-909f-6192-6eaf6feccabc], Content-Length=[167], MicrosoftSharePointTeamServices=[15.0.0.4420], SPRequestGuid=[5ef0f99b-24ec-909f-6192-6eaf6feccabc], X-AspNet-Version=[4.0.30319]}
> 11:05:17 ERROR hemistry.opencmis.workbench.ClientHelper: CmisInvalidArgumentException: One or more of the input parameters to the service method is missing or invalid.
org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException: One or more of the input parameters to the service method is missing or invalid.
at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.convertStatusCode(AbstractAtomPubService.java:423)
at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.read(AbstractAtomPubService.java:554)
at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.getTypeDefinitionInternal(AbstractAtomPubService.java:821)
at org.apache.chemistry.opencmis.client.bindings.spi.atompub.RepositoryServiceImpl.getTypeDefinition(RepositoryServiceImpl.java:88)
at org.apache.chemistry.opencmis.client.bindings.impl.RepositoryServiceImpl.getTypeDefinition(RepositoryServiceImpl.java:137)
at org.apache.chemistry.opencmis.client.runtime.SessionImpl.getTypeDefinition(SessionImpl.java:518)
at org.apache.chemistry.opencmis.workbench.model.ClientSession.createOperationContexts(ClientSession.java:244)
at org.apache.chemistry.opencmis.workbench.model.ClientSession.createSession(ClientSession.java:195)
at org.apache.chemistry.opencmis.workbench.LoginDialog$2.actionPerformed(LoginDialog.java:204)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2006)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2329)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:398)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:253)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:247)
> 11:05:17 ERROR hemistry.opencmis.workbench.ClientHelper: Error code: 0
Another thing that I noticed is that none of the URLs from the service document work when I use them from a browser. So i think the service doc doesn't have valid urls.
Give the latest CMIS Workbench a try:
https://repository.apache.org/content/repositories/orgapachechemistry-166/org/apache/chemistry/opencmis/chemistry-opencmis-workbench/0.9.0-beta-1/chemistry-opencmis-workbench-0.9.0-beta-1-full.zip
Didn't have the time to post the solution but here is basically what I had to do after getting help from Microsoft. I was missing Step B below:
A. Activate the CMIS feature for your sub site
Go to the Sharepoint 2013 Central Administration
Click on the Sites link and then click on your sub site. Or navigate directly to it. eg http://myserver/mysitename
Click on the Settings icon (gear top right) and then select Site Settings
Under Site Actions, click Manage Site Features
Click Activate for the CMIS producer.
B. Check Alternate Access Mappings
Go to the Central Administration page
Under System Settings, click Configure Alternate Access Mappings
There should be at least two urls. One with server short name and one with server full name.
If the url is missing, click Add Internal Urls
For the Alternate Access Mapping Collection, click the No Selection link, change and select:
SharePoint - 80
Set the url such as http://myserver.usa.com (full domain name)
Set Zone: any such as Intranet
Click Save
My suggestion would be to:
start the Workbench, do not login yet
close the connection popup
open the Log window with the button on the top right corner
increase the log level to DEBUG or more verbose
try to connect
check the logs again, possibly posting them here
The actual root of the problem turned out to be a missing Alternate Access Mapping. Not sure why it was missing in the first place.
So I added an internal url that has the full server name address instead of just the short name. A microsoft dev helped me figure this out.
Remove any proxy settings from internet explorer before you launch OpenCMIS, also reset any system wide proxy settings: netsh winhttp reset proxy
Make sure your share point web app is set to accept only basic authentication as described in the blog post you mentioned
Removing the proxy from IE and system wide fixed my problem .. I can now login to sharepoint 2013 using OpenCMIS
ah before i forget the URL syntax should be http://server:port/_vti_bin/cmis/rest/?getRepositories
Good luck

Link clicked in MS Word loses CF Session vars, but copied & pasted works fine

Been trying to figure this out for an hour now and I'm stymied. Simple site that allows employees to register. Typically the employer has a company wide u/p for all employees to use to access the registration page, but client also wanted a way to give employee a link to auto-login to register.
Simple enough - created a page "r.cfm" that looks for URL.emid (encrypted employer ID) and URL.h (5 character hash as a check based on the decrypted employer ID). A full URL may look something like this:
https://www.domain.com/r.cfm?emid=22EBCA&h=F5DEA
r.cfm makes sure the correct URL vars are there, decrypts the emid, compares the check value and if all is correct sets some session vars as such:
<cflock scope="session" type="exclusive" timeout="10">
<cfset SESSION.LOGGEDIN = TRUE/>
<cfset SESSION.LOGIN.EMPLOYEE.COID = DecryptString(url.emid)/>
</cflock>
I think use CFHEADER 302 and CFHEADER location to send them onto the next page. Here's where it gets weird. On the next page I setup some test code to e-mail me a dump of the session.
If clicked directly in MS Word I get to the 2nd page (the one from the cfheader redirect - employeeRegister.cfm) and I get not one - but two e-mail dumps of the session. The first one shows logged in as true, but the 2nd one shows it as false with a different jsessionid.
If I take the exact same link, paste it into my browser, it works as expected - one e-mail with a session dump showing that session.logged in true.
There is nothing on employeeRegister.cfm that would initiate a page reload. It actually doesn't even check the session.logged in var until the following page. employeeRegister.cfm is simply terms and conditions and a submit button to go to the next page, which is where the session vars are read and checked. It is literally a div with text and then a form tag with accept / decline.
This is because the office product initially tries to act as the browser (to test for web authoring) instead of handing off control to the browser right away. By the time the browser gets control of the url a valid session doesn't exist because office isn't going to share cookies. Without a valid session cookie you end up getting logged out during subsequent redirects or navigation of the site in question.
These MS KB article should help you solve the problem.
http://support.microsoft.com/kb/899927 <- mostly
http://support.microsoft.com/kb/218153 <- more info about Office links