]> www.infradead.org Git - users/dwmw2/ews-sync.git/commitdiff
Use NTLM auth for autodiscover too
authorDavid Woodhouse <dwmw2@infradead.org>
Fri, 16 Jul 2010 20:14:27 +0000 (21:14 +0100)
committerDavid Woodhouse <dwmw2@infradead.org>
Fri, 16 Jul 2010 20:14:27 +0000 (21:14 +0100)
autodiscover.sh

index e96bd94fb46cf2d15179166fa79626f8be0e1a98..e8b55762b1b23fc274d0fd16308f22902f7e8254 100755 (executable)
@@ -2,6 +2,12 @@
 
 EMAIL="$1"
 DOMAIN=${EMAIL##*@}
+CURLAUTH="--negotiate -u dummy:"
+# NTLM is faster, but requires your password
+
+if [ "$3" != "" ]; then
+    CURLAUTH="--ntlm -u $2:$3"
+fi
 
 QUERYFILE=$(mktemp /tmp/ewsqueryXXXXXX)
 RESULTFILE=$(mktemp /tmp/ewsresultXXXXXX)
@@ -19,7 +25,7 @@ EOF
 for ATTEMPT in $DOMAIN autodiscover.$DOMAIN; do
     if [ -n $EWSURL ]; then
        echo Trying $ATTEMPT...
-       if curl --negotiate -u dummy: -L -H "Content-Type: text/xml" \
+       if curl $CURLAUTH -L -H "Content-Type: text/xml" \
            https://$ATTEMPT/autodiscover/autodiscover.xml \
            -d @$QUERYFILE > $RESULTFILE; then
            EWSURL="$(sed -n -e '/EwsUrl/{s/.*<EwsUrl>\(.*\)<\/EwsUrl>.*/\1/p;q}' $RESULTFILE)"