Cool Solutions

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



By:

August 16, 2012 3:41 pm

Reads: 2433

Comments:1

Score:0

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
VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)

Tags: , ,
Categories: GroupWise, Technical

Disclaimer: This content is not supported by Novell. 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 it thoroughly before using it in a production environment.

1 Comment

  1. By:rodler

    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

    VN:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)

Comment

RSS