Article

smily_03's picture
article
Reads:

2264

Score:
1.4
1.4
5
 
Comments:

1

How to tell when a user is set up in Novell Data Synchronizer Mobility

Author Info

16 August 2012 - 2:41pm
Submitted by: smily_03

(View Disclaimer)

We wanted to be able to allow our users to enroll themselves in our DataSync server. And we wanted to let them know when they were set up, so that they could configure their devices. Adding the users to the system through LDAP is easy. The problem is, some users get set up quick, while others can take a bit. And then sometimes there's a random error and they're not set up at all. So, how can you tell the user when their account is set up, without someone having to watch things and tell them? The answer is easier than you think...

As long as you have a way of accessing their password programmatically, you can do it through a quick and easy web call.

Basically, the code below will connect to the NDS server (your.nds.server) with the username "username" and password "password". It will get the response code of the connection and print it out to the screen. If it returns 200, you're good. If it returns something else (500, 401, etc.) then that means the user isn't allowed to connect to the box -> not set up.

You can easily modify this code to do something other than display a "200" in a browser window.

The Java version I wrote, in the form of a JSP page:

<%@page import="java.net.URL"
        import="java.net.HttpURLConnection"
%>

<%
  try {
    String un = "username";
    String pw = "password";
    String encodedAuth = new sun.misc.BASE64Encoder().encode((un + ":" + pw).getBytes());
    
    URL url = new URL("https://your.nds.server/Microsoft-Server-ActiveSync");
    HttpURLConnection uc = (HttpURLConnection)url.openConnection();
    uc.setRequestMethod("OPTIONS");
    uc.setRequestProperty("User-Agent", "Apple-iPhone4c1/902.206");
    uc.setRequestProperty("Authorization","Basic " + encodedAuth);
    out.println(uc.getResponseCode());
    uc.disconnect();
  } catch (Exception e) {
    e.printStackTrace(new java.io.PrintWriter(out));
  }
%>

And, courtesy of Aaron Burgemeister, here's a bash version of the code:

MOBILITYSERVER='dsc.novell.com'
MOBILITYUSERNAME='aburgemeister'
MOBILITYUSERPASS='novell'
curl -v --request OPTIONS --user-agent 'Apple-iPhone4c1/902.206' --user "${MOBILITYUSERNAME}:${MOBILITYUSERPASS}" "https://${MOBILITYSERVER}/Microsoft-Server-ActiveSync" 2>&1 | grep 'HTTP/1.1' | grep 200 | grep -i ok
if [[ "$?" = "0" ]]; then
 echo "${MOBILITYUSERNAME} able to bind to ${MOBILITYSERVER} successfully."
else
 echo "${MOBILITYUSERNAME} failed to bind to ${MOBILITYSERVER}."
fi

Disclaimer: As with everything else at Cool Solutions, this content is definitely not supported by Novell (so don't even think of calling Support if you try something and it blows up).

It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test, test, test before you do anything drastic with it.




User Comments

rodler's picture

cooool!!! :-)

Submitted by rodler on 28 August 2012 - 8:41am.

please could novell implement this feature into the product itself???!!

...e. g. global settings checkbox: ...notify user via e-mail if provisioning ready...

tnx! gerald

© 2013 Novell