[CalendarServer-changes] [9927] PyKerberos/trunk

source_changes at macosforge.org source_changes at macosforge.org
Thu Oct 11 11:59:41 PDT 2012


Revision: 9927
          http://trac.calendarserver.org//changeset/9927
Author:   cdaboo at apple.com
Date:     2012-10-11 11:59:41 -0700 (Thu, 11 Oct 2012)
Log Message:
-----------
Initial some variables. Clean up test script.

Modified Paths:
--------------
    PyKerberos/trunk/src/kerberos.c
    PyKerberos/trunk/test.py

Modified: PyKerberos/trunk/src/kerberos.c
===================================================================
--- PyKerberos/trunk/src/kerberos.c	2012-10-11 16:02:34 UTC (rev 9926)
+++ PyKerberos/trunk/src/kerberos.c	2012-10-11 18:59:41 UTC (rev 9927)
@@ -27,10 +27,10 @@
 
 static PyObject *checkPassword(PyObject *self, PyObject *args)
 {
-    const char *user;
-    const char *pswd;
-    const char *service;
-    const char *default_realm;
+    const char *user = NULL;
+    const char *pswd = NULL;
+    const char *service = NULL;
+    const char *default_realm = NULL;
     int result = 0;
 
     if (!PyArg_ParseTuple(args, "ssss", &user, &pswd, &service, &default_realm))
@@ -46,8 +46,9 @@
 
 static PyObject *changePassword(PyObject *self, PyObject *args)
 {
-    const char *newpswd, *oldpswd;
-    const char *user;
+    const char *newpswd = NULL;
+    const char *oldpswd = NULL;
+    const char *user = NULL;
     int result = 0;
 
     if (!PyArg_ParseTuple(args, "sss", &user, &oldpswd, &newpswd))
@@ -63,8 +64,8 @@
 
 static PyObject *getServerPrincipalDetails(PyObject *self, PyObject *args)
 {
-    const char *service;
-    const char *hostname;
+    const char *service = NULL;
+    const char *hostname = NULL;
     char* result;
 
     if (!PyArg_ParseTuple(args, "ss", &service, &hostname))
@@ -84,8 +85,8 @@
 
 static PyObject* authGSSClientInit(PyObject* self, PyObject* args, PyObject* keywds)
 {
-    const char *service;
-    const char *principal;
+    const char *service = NULL;
+    const char *principal = NULL;
     gss_client_state *state;
     PyObject *pystate;
     static char *kwlist[] = {"service", "principal", "gssflags", NULL};
@@ -135,7 +136,7 @@
 {
     gss_client_state *state;
     PyObject *pystate;
-    char *challenge;
+    char *challenge = NULL;
     int result = 0;
 
     if (!PyArg_ParseTuple(args, "Os", &pystate, &challenge))
@@ -201,7 +202,7 @@
 {
 	gss_client_state *state;
 	PyObject *pystate;
-	char *challenge;
+	char *challenge = NULL;
 	int result = 0;
 
 	if (!PyArg_ParseTuple(args, "Os", &pystate, &challenge))
@@ -227,7 +228,8 @@
 {
 	gss_client_state *state;
 	PyObject *pystate;
-	char *challenge, *user = NULL;
+	char *challenge = NULL;
+	char *user = NULL;
 	int result = 0;
 
 	if (!PyArg_ParseTuple(args, "Os|z", &pystate, &challenge, &user))
@@ -251,7 +253,7 @@
 
 static PyObject *authGSSServerInit(PyObject *self, PyObject *args)
 {
-    const char *service;
+    const char *service = NULL;
     gss_server_state *state;
     PyObject *pystate;
     int result = 0;
@@ -299,7 +301,7 @@
 {
     gss_server_state *state;
     PyObject *pystate;
-    char *challenge;
+    char *challenge = NULL;
     int result = 0;
 
     if (!PyArg_ParseTuple(args, "Os", &pystate, &challenge))

Modified: PyKerberos/trunk/test.py
===================================================================
--- PyKerberos/trunk/test.py	2012-10-11 16:02:34 UTC (rev 9926)
+++ PyKerberos/trunk/test.py	2012-10-11 18:59:41 UTC (rev 9927)
@@ -1,3 +1,4 @@
+#!/usr/bin/env python
 ##
 # Copyright (c) 2006-2009 Apple Inc. All rights reserved.
 #
@@ -22,6 +23,21 @@
 import socket
 import ssl
 
+"""
+Examples:
+
+sudo ./test.py -s HTTP at example.com service
+
+sudo ./test.py -u user01 -p user01 -s HTTP at example.com -r EXAMPLE.COM basic
+
+sudo ./test.py -s HTTP at example.com -r EXAMPLE.COM gssapi
+
+./test.py -s HTTP at example.com -h calendar.example.com -p 8008 server
+
+For the gssapi and server tests you will need to kinit a principal on the server first.
+
+"""
+
 def main():
     
     # Extract arguments
@@ -115,7 +131,7 @@
     if rc != 1:
         return
     
-    rs, vs = kerberos.authGSSServerInit("");
+    rs, vs = kerberos.authGSSServerInit(service);
     print "Status for authGSSServerInit = %s" % statusText(rs);
     if rs != 1:
         return
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20121011/818c652b/attachment.html>


More information about the calendarserver-changes mailing list