commit_id
stringlengths
40
40
owner
stringclasses
29 values
repo
stringclasses
30 values
commit_message
stringlengths
1
409k
diff
stringlengths
147
117M
label
int64
0
0
8d69f800b7cb1e50abab8300ef5f78c3610df946
02strich
pykerberos
Removing 3.2 from travis b/c it is no longer fully supported
commit 8d69f800b7cb1e50abab8300ef5f78c3610df946 Author: Stefan Richter <[email protected]> Date: Thu Aug 3 20:19:46 2017 -0700 Removing 3.2 from travis b/c it is no longer fully supported diff --git a/.travis.yml b/.travis.yml index 0b2bd91..c8b0a63 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,6 @@ language: python python: - "2.6" - "2.7" - - "3.2" - "3.3" - "3.4" - "3.5"
0
293be8f08b5de31d14ba0b5bd2d08fd7e537197d
02strich
pykerberos
Merge pull request #42 from nitzmahone/py310_support fixes for Python 3.10
commit 293be8f08b5de31d14ba0b5bd2d08fd7e537197d Merge: 8d74c58 7e36e52 Author: Matt Davis <[email protected]> Date: Tue Nov 9 16:06:23 2021 -0800 Merge pull request #42 from nitzmahone/py310_support fixes for Python 3.10
0
c81d4341ec9052ca218cad9d047a7a971942a528
02strich
pykerberos
Fix TypeError when krb5-config is not present Here's what we see now with 1.1.12 in OpenStack CI Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/tmp.ixSstIV8nN/pip-build-x_yID4/pykerberos/setup.py", line 55, in <module> krb5_ver = check_krb5_version() File "/tmp/tmp.ixSstIV8nN/pip-build-x_yID4/pykerberos/setup.py", line 48, in check_krb5_version if len(krb5_vers) == 4: TypeError: object of type 'NoneType' has no len() http://logs.openstack.org/41/323141/5/check/gate-requirements-tox-py27-with-upper-constraints/04b5a1b/console.html
commit c81d4341ec9052ca218cad9d047a7a971942a528 Author: Davanum Srinivas <[email protected]> Date: Thu Jun 2 14:50:19 2016 -0400 Fix TypeError when krb5-config is not present Here's what we see now with 1.1.12 in OpenStack CI Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/tmp.ixSstIV8nN/pip-build-x_yID4/pykerberos/setup.py", line 55, in <module> krb5_ver = check_krb5_version() File "/tmp/tmp.ixSstIV8nN/pip-build-x_yID4/pykerberos/setup.py", line 48, in check_krb5_version if len(krb5_vers) == 4: TypeError: object of type 'NoneType' has no len() http://logs.openstack.org/41/323141/5/check/gate-requirements-tox-py27-with-upper-constraints/04b5a1b/console.html diff --git a/setup.py b/setup.py index 763ed3e..97e0c53 100644 --- a/setup.py +++ b/setup.py @@ -45,7 +45,7 @@ def check_krb5_config(*options, **kwargs): def check_krb5_version(): krb5_vers = check_krb5_config("--version") - if len(krb5_vers) == 4: + if krb5_vers and len(krb5_vers) == 4: if int(krb5_vers[3].split('.')[1].split('-')[0]) >= 10: return r'-DGSSAPI_EXT'
0
5a333bc156f0041043f35beae0bec9a0a78d3284
02strich
pykerberos
Merge pull request #5 from t-pare/master Fix check_krb5_version when krb5-config version minor realase number is post fixed with something
commit 5a333bc156f0041043f35beae0bec9a0a78d3284 Merge: 99ea78b 04f9fc2 Author: Stefan Richter <[email protected]> Date: Sun Jun 28 18:07:56 2015 -0700 Merge pull request #5 from t-pare/master Fix check_krb5_version when krb5-config version minor realase number is post fixed with something
0
5867201f1b9c682402aa9b495a654b8f346c8784
02strich
pykerberos
Adding missing optional marker in checkPassword
commit 5867201f1b9c682402aa9b495a654b8f346c8784 Author: Stefan Richter <[email protected]> Date: Sun Feb 7 15:37:51 2016 -0800 Adding missing optional marker in checkPassword diff --git a/src/kerberos.c b/src/kerberos.c index 528f541..0c21553 100644 --- a/src/kerberos.c +++ b/src/kerberos.c @@ -47,7 +47,7 @@ static PyObject *checkPassword(PyObject *self, PyObject *args) { const int verify = 1; int result = 0; - if (!PyArg_ParseTuple(args, "ssssb", &user, &pswd, &service, &default_realm, &verify)) { + if (!PyArg_ParseTuple(args, "ssss|b", &user, &pswd, &service, &default_realm, &verify)) { return NULL; }
0
2a5f2135dda7f6b7712665c9cee32f14393b633c
02strich
pykerberos
Merge pull request #27 from jborean93/add-cbt Added support for Channel Binding Tokens
commit 2a5f2135dda7f6b7712665c9cee32f14393b633c Merge: fed78cf fb2f3d9 Author: Jordan Borean <[email protected]> Date: Thu Sep 28 17:11:48 2017 +1000 Merge pull request #27 from jborean93/add-cbt Added support for Channel Binding Tokens
0
0e2be8deac978d357c79cb8c7a66c4835752f23b
02strich
pykerberos
Add travis config
commit 0e2be8deac978d357c79cb8c7a66c4835752f23b Author: Stefan Richter <[email protected]> Date: Thu May 26 19:07:17 2016 -0700 Add travis config diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..2f63ab9 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,13 @@ +language: python +python: + - "2.6" + - "2.7" + - "3.2" + - "3.3" + - "3.4" + - "3.5" +before_install: + - sudo apt-get update -qq + - sudo apt-get install libkrb5-dev +install: + - pip install .
0
f3dfd71c97b0abcf09bc58f2a07bcabec07eb72c
02strich
pykerberos
Merge pull request #1 from ajdavis/py26 Python 2.6 compatibility in setup.py
commit f3dfd71c97b0abcf09bc58f2a07bcabec07eb72c Merge: fa8b0c3 ba3512a Author: Stefan Richter <[email protected]> Date: Tue Mar 25 10:19:04 2014 +0100 Merge pull request #1 from ajdavis/py26 Python 2.6 compatibility in setup.py
0
57b19f5b1e04dc8860b001829b1fe31868420dba
02strich
pykerberos
1.2.1 final release
commit 57b19f5b1e04dc8860b001829b1fe31868420dba Author: Matt Davis <[email protected]> Date: Wed Dec 20 10:22:22 2017 -0800 1.2.1 final release diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 4d3d4d7..fc61bd2 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,4 +1,4 @@ -v1.2.1.beta1 (8 Dec 2017) +v1.2.1 (20 Dec 2017) * Added support for passing channel binding tokens * added WinRM IOV message encryption/decryption (raw byte buffers) diff --git a/setup.py b/setup.py index 1c770d7..1bac8ef 100644 --- a/setup.py +++ b/setup.py @@ -58,7 +58,7 @@ if krb5_ver: setup ( name = "pykerberos", - version = "1.2.1.beta1", + version = "1.2.1", description = "High-level interface to Kerberos", long_description=long_description, license="ASL 2.0",
0
6042a5e1c18f5cd13c4dc8afb9f525fe7de1d495
02strich
pykerberos
improve error message if krb5-config is missing #3
commit 6042a5e1c18f5cd13c4dc8afb9f525fe7de1d495 Author: Stefan Richter <[email protected]> Date: Mon May 18 21:21:07 2015 -0700 improve error message if krb5-config is missing #3 diff --git a/setup.py b/setup.py index 9207266..3263c2c 100644 --- a/setup.py +++ b/setup.py @@ -26,33 +26,29 @@ Kerberos authentication based on <http://www.ietf.org/rfc/rfc4559.txt>. """ -# Backport from Python 2.7 in case we're in 2.6. -def check_output(*popenargs, **kwargs): - process = subprocess.Popen(stdout=subprocess.PIPE, *popenargs, **kwargs) - output, unused_err = process.communicate() - retcode = process.poll() - if retcode: - cmd = kwargs.get("args") - if cmd is None: - cmd = popenargs[0] - raise subprocess.CalledProcessError(retcode, cmd, output=output) - return output +def check_krb5_config(*options): + try: + process = subprocess.Popen(("krb5-config",) + options, stdout=subprocess.PIPE, universal_newlines=True) + output, unused_err = process.communicate() + retcode = process.poll() + if retcode: + cmd = kwargs.get("args") + if cmd is None: + cmd = popenargs[0] + raise subprocess.CalledProcessError(retcode, cmd, output=output) + return output.split() + except OSError as e: + if e.errno == 2: + raise Exception("You are missing krb5-config") def check_krb5_version(): - krb5_vers = check_output(["krb5-config", "--version"], universal_newlines=True).split() + krb5_vers = check_krb5_config("--version") if len(krb5_vers) == 4: if int(krb5_vers[3].split('.')[1]) >= 10: return r'-DGSSAPI_EXT' -extra_link_args = check_output( - ["krb5-config", "--libs", "gssapi"], - universal_newlines=True -).split() - -extra_compile_args = check_output( - ["krb5-config", "--cflags", "gssapi"], - universal_newlines=True -).split() +extra_link_args = check_krb5_config("--libs", "gssapi") +extra_compile_args = check_krb5_config("--cflags", "gssapi") krb5_ver = check_krb5_version() if krb5_ver:
0
ec57f5462b424594d0b9d8b33865f6e30917f135
02strich
pykerberos
Use `memcpy` instead of the unportable glibc variant, `mempcpy` This will fix pykerberos on all systems that lack `mempcpy`, e.g., FreeBSD, OSX, etc. Closes #37. Signed-off-by: Enji Cooper <[email protected]>
commit ec57f5462b424594d0b9d8b33865f6e30917f135 Author: Enji Cooper <[email protected]> Date: Wed Feb 26 17:42:08 2020 -0800 Use `memcpy` instead of the unportable glibc variant, `mempcpy` This will fix pykerberos on all systems that lack `mempcpy`, e.g., FreeBSD, OSX, etc. Closes #37. Signed-off-by: Enji Cooper <[email protected]> diff --git a/src/kerberosgss.c b/src/kerberosgss.c index ae440e0..4a885c0 100644 --- a/src/kerberosgss.c +++ b/src/kerberosgss.c @@ -873,9 +873,10 @@ int encrypt_message(gss_client_state *state, char *message_input, char **header, *encrypted_data_len = iov[1].buffer.length + iov[2].buffer.length; *encrypted_data = malloc(*encrypted_data_len); outloc = *encrypted_data; - outloc = mempcpy(outloc, iov[1].buffer.value, iov[1].buffer.length); + memcpy(outloc, iov[1].buffer.value, iov[1].buffer.length); + outloc += iov[1].buffer.length; // NB: no-op if no padding is necessary (which seems to always be the case with aes256-cts-hmac-sha1-96) - mempcpy(outloc, iov[2].buffer.value, iov[2].buffer.length); + memcpy(outloc, iov[2].buffer.value, iov[2].buffer.length); ret = 0; end: @@ -921,4 +922,4 @@ int decrypt_message(gss_client_state *state, char *header, int header_len, char end: return ret; } -#endif \ No newline at end of file +#endif
0
9042d4cb002618624c758d22a4c4de34d00c0629
02strich
pykerberos
Merge pull request #4 from dave-bouchillon/master Add MSFT encryption support
commit 9042d4cb002618624c758d22a4c4de34d00c0629 Merge: b8721ac 1de650c Author: Stefan Richter <[email protected]> Date: Mon Apr 13 22:00:42 2015 -0700 Merge pull request #4 from dave-bouchillon/master Add MSFT encryption support
0
04f9fc29238cf42f893b15a4eb1c2344317802b4
02strich
pykerberos
Fix check_krb5_version when krb5-config version minor realase number is post fixed with something
commit 04f9fc29238cf42f893b15a4eb1c2344317802b4 Author: Thomas Pare <[email protected]> Date: Wed Jun 24 19:14:19 2015 -0700 Fix check_krb5_version when krb5-config version minor realase number is post fixed with something diff --git a/setup.py b/setup.py index ad6c693..2129937 100644 --- a/setup.py +++ b/setup.py @@ -44,7 +44,7 @@ def check_krb5_config(*options): def check_krb5_version(): krb5_vers = check_krb5_config("--version") if len(krb5_vers) == 4: - if int(krb5_vers[3].split('.')[1]) >= 10: + if int(krb5_vers[3].split('.')[1].split('-')[0]) >= 10: return r'-DGSSAPI_EXT' extra_link_args = check_krb5_config("--libs", "gssapi")
0
42ddf7fb2d2f7cdf0bb2e86e6a0566ab1fd00c36
02strich
pykerberos
style fixes and better py3 defines
commit 42ddf7fb2d2f7cdf0bb2e86e6a0566ab1fd00c36 Author: Stefan Richter <[email protected]> Date: Sun Nov 8 20:30:52 2015 -0800 style fixes and better py3 defines diff --git a/src/kerberos.c b/src/kerberos.c index d2d25fe..0a18786 100644 --- a/src/kerberos.c +++ b/src/kerberos.c @@ -22,6 +22,16 @@ #if PY_MAJOR_VERSION >= 3 #define PyInt_FromLong PyLong_FromLong + + #define PyNew(object) PyCapsule_New(object, NULL, NULL) + #define PyCheck(object) PyCapsule_CheckExact(object) + #define PyGet(object, type) PyCapsule_GetPointer(object, NULL) + #define PyClear(object) PyCapsule_SetPointer(object, NULL) +#else + #define PyNew(object) PyCObject_FromVoidPtr(object, NULL) + #define PyCheck(object) PyCObject_Check(object) + #define PyGet(object, type) (type *)PyCObject_AsVoidPtr(object) + #define PyClear(object) PyCObject_SetVoidPtr(object, NULL) #endif PyObject *KrbException_class; @@ -29,8 +39,7 @@ PyObject *BasicAuthException_class; PyObject *PwdChangeException_class; PyObject *GssException_class; -static PyObject *checkPassword(PyObject *self, PyObject *args) -{ +static PyObject *checkPassword(PyObject *self, PyObject *args) { const char *user = NULL; const char *pswd = NULL; const char *service = NULL; @@ -38,58 +47,59 @@ static PyObject *checkPassword(PyObject *self, PyObject *args) const int verify = 1; int result = 0; - if (!PyArg_ParseTuple(args, "ssssb", &user, &pswd, &service, &default_realm, &verify)) + if (!PyArg_ParseTuple(args, "ssssb", &user, &pswd, &service, &default_realm, &verify)) { return NULL; + } result = authenticate_user_krb5pwd(user, pswd, service, default_realm, verify); - if (result) + if (result) { return Py_INCREF(Py_True), Py_True; - else + } else { return NULL; + } } -static PyObject *changePassword(PyObject *self, PyObject *args) -{ +static PyObject *changePassword(PyObject *self, PyObject *args) { const char *newpswd = NULL; const char *oldpswd = NULL; const char *user = NULL; int result = 0; - if (!PyArg_ParseTuple(args, "sss", &user, &oldpswd, &newpswd)) + if (!PyArg_ParseTuple(args, "sss", &user, &oldpswd, &newpswd)) { return NULL; + } result = change_user_krb5pwd(user, oldpswd, newpswd); - if (result) - return Py_INCREF(Py_True), Py_True; - else - return NULL; + if (result) { + return Py_INCREF(Py_True), Py_True; + } else { + return NULL; + } } -static PyObject *getServerPrincipalDetails(PyObject *self, PyObject *args) -{ +static PyObject *getServerPrincipalDetails(PyObject *self, PyObject *args) { const char *service = NULL; const char *hostname = NULL; char* result; - if (!PyArg_ParseTuple(args, "ss", &service, &hostname)) + if (!PyArg_ParseTuple(args, "ss", &service, &hostname)) { return NULL; + } result = server_principal_details(service, hostname); - if (result != NULL) - { + if (result != NULL) { PyObject* pyresult = Py_BuildValue("s", result); free(result); return pyresult; - } - else + } else { return NULL; + } } -static PyObject* authGSSClientInit(PyObject* self, PyObject* args, PyObject* keywds) -{ +static PyObject* authGSSClientInit(PyObject* self, PyObject* args, PyObject* keywds) { const char *service = NULL; const char *principal = NULL; gss_client_state *state; @@ -98,499 +108,390 @@ static PyObject* authGSSClientInit(PyObject* self, PyObject* args, PyObject* key long int gss_flags = GSS_C_MUTUAL_FLAG | GSS_C_SEQUENCE_FLAG; int result = 0; - if (!PyArg_ParseTupleAndKeywords(args, keywds, "s|zl", kwlist, &service, &principal, &gss_flags)) + if (!PyArg_ParseTupleAndKeywords(args, keywds, "s|zl", kwlist, &service, &principal, &gss_flags)) { return NULL; + } state = (gss_client_state *) malloc(sizeof(gss_client_state)); -#if PY_MAJOR_VERSION >= 3 - pystate = PyCapsule_New(state, NULL, NULL); -#else - pystate = PyCObject_FromVoidPtr(state, NULL); -#endif + pystate = PyNew(state); result = authenticate_gss_client_init(service, principal, gss_flags, state); - if (result == AUTH_GSS_ERROR) + if (result == AUTH_GSS_ERROR) { return NULL; + } return Py_BuildValue("(iO)", result, pystate); } -static PyObject *authGSSClientClean(PyObject *self, PyObject *args) -{ +static PyObject *authGSSClientClean(PyObject *self, PyObject *args) { gss_client_state *state; PyObject *pystate; int result = 0; - if (!PyArg_ParseTuple(args, "O", &pystate)) + if (!PyArg_ParseTuple(args, "O", &pystate)) { return NULL; + } -#if PY_MAJOR_VERSION >= 3 - if (!PyCapsule_CheckExact(pystate)) { -#else - if (!PyCObject_Check(pystate)) { -#endif + if (!PyCheck(pystate)) { PyErr_SetString(PyExc_TypeError, "Expected a context object"); return NULL; } -#if PY_MAJOR_VERSION >= 3 - state = PyCapsule_GetPointer(pystate, NULL); -#else - state = (gss_client_state *)PyCObject_AsVoidPtr(pystate); -#endif - if (state != NULL) - { + state = PyGet(pystate, gss_client_state); + if (state != NULL) { result = authenticate_gss_client_clean(state); free(state); -#if PY_MAJOR_VERSION >= 3 - PyCapsule_SetPointer(pystate, NULL); -#else - PyCObject_SetVoidPtr(pystate, NULL); -#endif + PyClear(pystate); } return Py_BuildValue("i", result); } -static PyObject *authGSSClientStep(PyObject *self, PyObject *args) -{ +static PyObject *authGSSClientStep(PyObject *self, PyObject *args) { gss_client_state *state; PyObject *pystate; char *challenge = NULL; int result = 0; - if (!PyArg_ParseTuple(args, "Os", &pystate, &challenge)) + if (!PyArg_ParseTuple(args, "Os", &pystate, &challenge)) { return NULL; + } -#if PY_MAJOR_VERSION >= 3 - if (!PyCapsule_CheckExact(pystate)) { -#else - if (!PyCObject_Check(pystate)) { -#endif + if (!PyCheck(pystate)) { PyErr_SetString(PyExc_TypeError, "Expected a context object"); return NULL; } -#if PY_MAJOR_VERSION >= 3 - state = PyCapsule_GetPointer(pystate, NULL); -#else - state = (gss_client_state *)PyCObject_AsVoidPtr(pystate); -#endif - if (state == NULL) + state = PyGet(pystate, gss_client_state); + if (state == NULL) { return NULL; + } result = authenticate_gss_client_step(state, challenge); - if (result == AUTH_GSS_ERROR) + if (result == AUTH_GSS_ERROR) { return NULL; + } return Py_BuildValue("i", result); } -static PyObject *authGSSClientResponseConf(PyObject *self, PyObject *args) -{ +static PyObject *authGSSClientResponseConf(PyObject *self, PyObject *args) { gss_client_state *state; PyObject *pystate; - if (!PyArg_ParseTuple(args, "O", &pystate)) + if (!PyArg_ParseTuple(args, "O", &pystate)) { return NULL; + } -#if PY_MAJOR_VERSION >= 3 - if (!PyCapsule_CheckExact(pystate)) { -#else - if (!PyCObject_Check(pystate)) { -#endif + if (!PyCheck(pystate)) { PyErr_SetString(PyExc_TypeError, "Expected a context object"); return NULL; } -#if PY_MAJOR_VERSION >= 3 - state = PyCapsule_GetPointer(pystate, NULL); -#else - state = (gss_client_state *)PyCObject_AsVoidPtr(pystate); -#endif - if (state == NULL) + state = PyGet(pystate, gss_client_state); + if (state == NULL) { return NULL; + } return Py_BuildValue("i", state->responseConf); } -static PyObject *authGSSClientResponse(PyObject *self, PyObject *args) -{ +static PyObject *authGSSClientResponse(PyObject *self, PyObject *args) { gss_client_state *state; PyObject *pystate; - if (!PyArg_ParseTuple(args, "O", &pystate)) + if (!PyArg_ParseTuple(args, "O", &pystate)) { return NULL; + } -#if PY_MAJOR_VERSION >= 3 - if (!PyCapsule_CheckExact(pystate)) { -#else - if (!PyCObject_Check(pystate)) { -#endif + if (!PyCheck(pystate)) { PyErr_SetString(PyExc_TypeError, "Expected a context object"); return NULL; } -#if PY_MAJOR_VERSION >= 3 - state = PyCapsule_GetPointer(pystate, NULL); -#else - state = (gss_client_state *)PyCObject_AsVoidPtr(pystate); -#endif - if (state == NULL) + state = PyGet(pystate, gss_client_state); + if (state == NULL) { return NULL; + } return Py_BuildValue("s", state->response); } -static PyObject *authGSSClientUserName(PyObject *self, PyObject *args) -{ +static PyObject *authGSSClientUserName(PyObject *self, PyObject *args) { gss_client_state *state; PyObject *pystate; - if (!PyArg_ParseTuple(args, "O", &pystate)) + if (!PyArg_ParseTuple(args, "O", &pystate)) { return NULL; + } -#if PY_MAJOR_VERSION >= 3 - if (!PyCapsule_CheckExact(pystate)) { -#else - if (!PyCObject_Check(pystate)) { -#endif + if (!PyCheck(pystate)) { PyErr_SetString(PyExc_TypeError, "Expected a context object"); return NULL; } -#if PY_MAJOR_VERSION >= 3 - state = PyCapsule_GetPointer(pystate, NULL); -#else - state = (gss_client_state *)PyCObject_AsVoidPtr(pystate); -#endif - if (state == NULL) + state = PyGet(pystate, gss_client_state); + if (state == NULL) { return NULL; + } return Py_BuildValue("s", state->username); } -static PyObject *authGSSClientUnwrap(PyObject *self, PyObject *args) -{ - gss_client_state *state; - PyObject *pystate; - char *challenge = NULL; - int result = 0; +static PyObject *authGSSClientUnwrap(PyObject *self, PyObject *args) { + gss_client_state *state; + PyObject *pystate; + char *challenge = NULL; + int result = 0; - if (!PyArg_ParseTuple(args, "Os", &pystate, &challenge)) - return NULL; + if (!PyArg_ParseTuple(args, "Os", &pystate, &challenge)) { + return NULL; + } -#if PY_MAJOR_VERSION >= 3 - if (!PyCapsule_CheckExact(pystate)) { -#else - if (!PyCObject_Check(pystate)) { -#endif - PyErr_SetString(PyExc_TypeError, "Expected a context object"); - return NULL; - } + if (!PyCheck(pystate)) { + PyErr_SetString(PyExc_TypeError, "Expected a context object"); + return NULL; + } -#if PY_MAJOR_VERSION >= 3 - state = PyCapsule_GetPointer(pystate, NULL); -#else - state = (gss_client_state *)PyCObject_AsVoidPtr(pystate); -#endif - if (state == NULL) - return NULL; + state = PyGet(pystate, gss_client_state); + if (state == NULL) { + return NULL; + } - result = authenticate_gss_client_unwrap(state, challenge); - if (result == AUTH_GSS_ERROR) - return NULL; + result = authenticate_gss_client_unwrap(state, challenge); + if (result == AUTH_GSS_ERROR) { + return NULL; + } - return Py_BuildValue("i", result); + return Py_BuildValue("i", result); } #ifdef GSSAPI_EXT -static PyObject *authGSSClientUnwrapIov(PyObject *self, PyObject *args) -{ - gss_client_state *state; - PyObject *pystate; - char *challenge = NULL; - int result = 0; +static PyObject *authGSSClientUnwrapIov(PyObject *self, PyObject *args) { + gss_client_state *state; + PyObject *pystate; + char *challenge = NULL; + int result = 0; - if (!PyArg_ParseTuple(args, "Os", &pystate, &challenge)) - return NULL; + if (!PyArg_ParseTuple(args, "Os", &pystate, &challenge)) { + return NULL; + } -#if PY_MAJOR_VERSION >= 3 - if (!PyCapsule_CheckExact(pystate)) { -#else - if (!PyCObject_Check(pystate)) { -#endif - PyErr_SetString(PyExc_TypeError, "Expected a context object"); - return NULL; - } + if (!PyCheck(pystate)) { + PyErr_SetString(PyExc_TypeError, "Expected a context object"); + return NULL; + } -#if PY_MAJOR_VERSION >= 3 - state = PyCapsule_GetPointer(pystate, NULL); -#else - state = (gss_client_state *)PyCObject_AsVoidPtr(pystate); -#endif - if (state == NULL) - return NULL; + state = PyGet(pystate, gss_client_state); + if (state == NULL) { + return NULL; + } - result = authenticate_gss_client_unwrap_iov(state, challenge); - if (result == AUTH_GSS_ERROR) - return NULL; + result = authenticate_gss_client_unwrap_iov(state, challenge); + if (result == AUTH_GSS_ERROR) { + return NULL; + } - return Py_BuildValue("i", result); + return Py_BuildValue("i", result); } #endif -static PyObject *authGSSClientWrap(PyObject *self, PyObject *args) -{ - gss_client_state *state; - PyObject *pystate; - char *challenge = NULL; - char *user = NULL; +static PyObject *authGSSClientWrap(PyObject *self, PyObject *args) { + gss_client_state *state; + PyObject *pystate; + char *challenge = NULL; + char *user = NULL; int protect = 0; - int result = 0; + int result = 0; - if (!PyArg_ParseTuple(args, "Os|zi", &pystate, &challenge, &user, &protect)) - return NULL; + if (!PyArg_ParseTuple(args, "Os|zi", &pystate, &challenge, &user, &protect)) { + return NULL; + } -#if PY_MAJOR_VERSION >= 3 - if (!PyCapsule_CheckExact(pystate)) { -#else - if (!PyCObject_Check(pystate)) { -#endif - PyErr_SetString(PyExc_TypeError, "Expected a context object"); - return NULL; - } + if (!PyCheck(pystate)) { + PyErr_SetString(PyExc_TypeError, "Expected a context object"); + return NULL; + } -#if PY_MAJOR_VERSION >= 3 - state = PyCapsule_GetPointer(pystate, NULL); -#else - state = (gss_client_state *)PyCObject_AsVoidPtr(pystate); -#endif - if (state == NULL) - return NULL; + state = PyGet(pystate, gss_client_state); + if (state == NULL) { + return NULL; + } - result = authenticate_gss_client_wrap(state, challenge, user, protect); - if (result == AUTH_GSS_ERROR) - return NULL; + result = authenticate_gss_client_wrap(state, challenge, user, protect); + if (result == AUTH_GSS_ERROR) { + return NULL; + } - return Py_BuildValue("i", result); + return Py_BuildValue("i", result); } #ifdef GSSAPI_EXT -static PyObject *authGSSClientWrapIov(PyObject *self, PyObject *args) -{ - gss_client_state *state; - PyObject *pystate; - char *challenge = NULL; - int protect = 1; - int result = 0; - int pad_len = 0; +static PyObject *authGSSClientWrapIov(PyObject *self, PyObject *args) { + gss_client_state *state; + PyObject *pystate; + char *challenge = NULL; + int protect = 1; + int result = 0; + int pad_len = 0; - if (!PyArg_ParseTuple(args, "Os|i", &pystate, &challenge, &protect)) - return NULL; + if (!PyArg_ParseTuple(args, "Os|i", &pystate, &challenge, &protect)) { + return NULL; + } -#if PY_MAJOR_VERSION >= 3 - if (!PyCapsule_CheckExact(pystate)) { -#else - if (!PyCObject_Check(pystate)) { -#endif - PyErr_SetString(PyExc_TypeError, "Expected a context object"); - return NULL; - } + if (!PyCheck(pystate)) { + PyErr_SetString(PyExc_TypeError, "Expected a context object"); + return NULL; + } -#if PY_MAJOR_VERSION >= 3 - state = PyCapsule_GetPointer(pystate, NULL); -#else - state = (gss_client_state *)PyCObject_AsVoidPtr(pystate); -#endif - if (state == NULL) - return NULL; + state = PyGet(pystate, gss_client_state); + if (state == NULL) { + return NULL; + } - result = authenticate_gss_client_wrap_iov(state, challenge, protect, &pad_len); - if (result == AUTH_GSS_ERROR) - return NULL; + result = authenticate_gss_client_wrap_iov(state, challenge, protect, &pad_len); + if (result == AUTH_GSS_ERROR) { + return NULL; + } - return Py_BuildValue("ii", result, pad_len); + return Py_BuildValue("ii", result, pad_len); } #endif -static PyObject *authGSSServerInit(PyObject *self, PyObject *args) -{ +static PyObject *authGSSServerInit(PyObject *self, PyObject *args) { const char *service = NULL; gss_server_state *state; PyObject *pystate; int result = 0; - if (!PyArg_ParseTuple(args, "s", &service)) + if (!PyArg_ParseTuple(args, "s", &service)) { return NULL; + } state = (gss_server_state *) malloc(sizeof(gss_server_state)); -#if PY_MAJOR_VERSION >= 3 - pystate = PyCapsule_New(state, NULL, NULL); -#else - pystate = PyCObject_FromVoidPtr(state, NULL); -#endif + pystate = PyNew(state); result = authenticate_gss_server_init(service, state); - if (result == AUTH_GSS_ERROR) + if (result == AUTH_GSS_ERROR) { return NULL; + } return Py_BuildValue("(iO)", result, pystate); } -static PyObject *authGSSServerClean(PyObject *self, PyObject *args) -{ +static PyObject *authGSSServerClean(PyObject *self, PyObject *args) { gss_server_state *state; PyObject *pystate; int result = 0; - if (!PyArg_ParseTuple(args, "O", &pystate)) + if (!PyArg_ParseTuple(args, "O", &pystate)) { return NULL; + } -#if PY_MAJOR_VERSION >= 3 - if (!PyCapsule_CheckExact(pystate)) { -#else - if (!PyCObject_Check(pystate)) { -#endif + if (!PyCheck(pystate)) { PyErr_SetString(PyExc_TypeError, "Expected a context object"); return NULL; } -#if PY_MAJOR_VERSION >= 3 - state = PyCapsule_GetPointer(pystate, NULL); -#else - state = (gss_server_state *)PyCObject_AsVoidPtr(pystate); -#endif - if (state != NULL) - { + state = PyGet(pystate, gss_server_state); + if (state != NULL) { result = authenticate_gss_server_clean(state); free(state); -#if PY_MAJOR_VERSION >= 3 - PyCapsule_SetPointer(pystate, NULL); -#else - PyCObject_SetVoidPtr(pystate, NULL); -#endif + PyClear(pystate); } return Py_BuildValue("i", result); } -static PyObject *authGSSServerStep(PyObject *self, PyObject *args) -{ +static PyObject *authGSSServerStep(PyObject *self, PyObject *args) { gss_server_state *state; PyObject *pystate; char *challenge = NULL; int result = 0; - if (!PyArg_ParseTuple(args, "Os", &pystate, &challenge)) + if (!PyArg_ParseTuple(args, "Os", &pystate, &challenge)) { return NULL; + } -#if PY_MAJOR_VERSION >= 3 - if (!PyCapsule_CheckExact(pystate)) { -#else - if (!PyCObject_Check(pystate)) { -#endif + if (!PyCheck(pystate)) { PyErr_SetString(PyExc_TypeError, "Expected a context object"); return NULL; } -#if PY_MAJOR_VERSION >= 3 - state = PyCapsule_GetPointer(pystate, NULL); -#else - state = (gss_server_state *)PyCObject_AsVoidPtr(pystate); -#endif - if (state == NULL) + state = PyGet(pystate, gss_server_state); + if (state == NULL) { return NULL; + } result = authenticate_gss_server_step(state, challenge); - if (result == AUTH_GSS_ERROR) + if (result == AUTH_GSS_ERROR) { return NULL; + } return Py_BuildValue("i", result); } -static PyObject *authGSSServerResponse(PyObject *self, PyObject *args) -{ +static PyObject *authGSSServerResponse(PyObject *self, PyObject *args) { gss_server_state *state; PyObject *pystate; - if (!PyArg_ParseTuple(args, "O", &pystate)) + if (!PyArg_ParseTuple(args, "O", &pystate)) { return NULL; + } -#if PY_MAJOR_VERSION >= 3 - if (!PyCapsule_CheckExact(pystate)) { -#else - if (!PyCObject_Check(pystate)) { -#endif + if (!PyCheck(pystate)) { PyErr_SetString(PyExc_TypeError, "Expected a context object"); return NULL; } -#if PY_MAJOR_VERSION >= 3 - state = PyCapsule_GetPointer(pystate, NULL); -#else - state = (gss_server_state *)PyCObject_AsVoidPtr(pystate); -#endif - if (state == NULL) + state = PyGet(pystate, gss_server_state); + if (state == NULL) { return NULL; + } return Py_BuildValue("s", state->response); } -static PyObject *authGSSServerUserName(PyObject *self, PyObject *args) -{ +static PyObject *authGSSServerUserName(PyObject *self, PyObject *args) { gss_server_state *state; PyObject *pystate; - if (!PyArg_ParseTuple(args, "O", &pystate)) + if (!PyArg_ParseTuple(args, "O", &pystate)) { return NULL; + } -#if PY_MAJOR_VERSION >= 3 - if (!PyCapsule_CheckExact(pystate)) { -#else - if (!PyCObject_Check(pystate)) { -#endif + if (!PyCheck(pystate)) { PyErr_SetString(PyExc_TypeError, "Expected a context object"); return NULL; } -#if PY_MAJOR_VERSION >= 3 - state = PyCapsule_GetPointer(pystate, NULL); -#else - state = (gss_server_state *)PyCObject_AsVoidPtr(pystate); -#endif - if (state == NULL) + state = PyGet(pystate, gss_server_state); + if (state == NULL) { return NULL; + } return Py_BuildValue("s", state->username); } -static PyObject *authGSSServerTargetName(PyObject *self, PyObject *args) -{ +static PyObject *authGSSServerTargetName(PyObject *self, PyObject *args) { gss_server_state *state; PyObject *pystate; - if (!PyArg_ParseTuple(args, "O", &pystate)) + if (!PyArg_ParseTuple(args, "O", &pystate)) { return NULL; + } -#if PY_MAJOR_VERSION >= 3 - if (!PyCapsule_CheckExact(pystate)) { -#else - if (!PyCObject_Check(pystate)) { -#endif + if (!PyCheck(pystate)) { PyErr_SetString(PyExc_TypeError, "Expected a context object"); return NULL; } -#if PY_MAJOR_VERSION >= 3 - state = PyCapsule_GetPointer(pystate, NULL); -#else - state = (gss_server_state *)PyCObject_AsVoidPtr(pystate); -#endif - if (state == NULL) + state = PyGet(pystate, gss_server_state); + if (state == NULL) { return NULL; + } return Py_BuildValue("s", state->targetname); }
0
fb2f3d9b1cf8e805b3a541ea6eda92a9794d7ca0
02strich
pykerberos
minor change to CBT struct
commit fb2f3d9b1cf8e805b3a541ea6eda92a9794d7ca0 Author: jborean93 <[email protected]> Date: Thu Sep 28 17:09:54 2017 +1000 minor change to CBT struct diff --git a/src/kerberos.c b/src/kerberos.c index e6c9007..719924c 100644 --- a/src/kerberos.c +++ b/src/kerberos.c @@ -196,9 +196,9 @@ static PyObject *channelBindings(PyObject *self, PyObject *args, PyObject* keywd char *initiator_address = NULL; char *acceptor_address = NULL; char *application_data = NULL; - int initiator_length = NULL; - int acceptor_length = NULL; - int application_length = NULL; + int initiator_length = 0; + int acceptor_length = 0; + int application_length = 0; PyObject *pychan_bindings = NULL; struct gss_channel_bindings_struct *input_chan_bindings;
0
e90f3f79ed0783551a12bbd8324876266972ef48
02strich
pykerberos
Merge pull request #25 from veklov/master Added option for setting gss mech oid (allows to implement SPNEGO authentication)
commit e90f3f79ed0783551a12bbd8324876266972ef48 Merge: 970e568 388d0e6 Author: Stefan Richter <[email protected]> Date: Wed Jan 25 23:32:19 2017 -0800 Merge pull request #25 from veklov/master Added option for setting gss mech oid (allows to implement SPNEGO authentication)
0
6c6602fdfe2b709897658fb6e4f8dc73b2ad014d
02strich
pykerberos
Add suport for krb5-config.mit
commit 6c6602fdfe2b709897658fb6e4f8dc73b2ad014d Author: Stefan Richter <[email protected]> Date: Mon Dec 14 21:02:18 2015 -0800 Add suport for krb5-config.mit diff --git a/setup.py b/setup.py index 5705a38..092de24 100644 --- a/setup.py +++ b/setup.py @@ -26,9 +26,9 @@ Kerberos authentication based on <http://www.ietf.org/rfc/rfc4559.txt>. """ -def check_krb5_config(*options): +def check_krb5_config(*options, **kwargs): try: - process = subprocess.Popen(("krb5-config",) + options, stdout=subprocess.PIPE, universal_newlines=True) + process = subprocess.Popen((kwargs.get('command_name', 'krb5-config'),) + options, stdout=subprocess.PIPE, universal_newlines=True) output, unused_err = process.communicate() retcode = process.poll() if retcode: @@ -39,7 +39,11 @@ def check_krb5_config(*options): return output.split() except OSError as e: if e.errno == 2: - raise Exception("You are missing krb5-config") + try: + return check_krb5_config(*options, command_name="krb5-config.mit") + except OSError as e2: + if e2.errno == 2: + raise Exception("You are missing krb5-config(.mit)") def check_krb5_version(): krb5_vers = check_krb5_config("--version")
0
ba3512ad23d9cdaad0b467c3adaa2adfdd327adf
02strich
pykerberos
Python 2.6 compatibility in setup.py
commit ba3512ad23d9cdaad0b467c3adaa2adfdd327adf Author: A. Jesse Jiryu Davis <[email protected]> Date: Mon Mar 24 22:57:36 2014 -0400 Python 2.6 compatibility in setup.py diff --git a/setup.py b/setup.py index 94ad0f8..8ad1dc4 100644 --- a/setup.py +++ b/setup.py @@ -26,6 +26,30 @@ Kerberos authentication based on <http://www.ietf.org/rfc/rfc4559.txt>. """ +# Backport from Python 2.7 in case we're in 2.6. +def check_output(*popenargs, **kwargs): + process = subprocess.Popen(stdout=subprocess.PIPE, *popenargs, **kwargs) + output, unused_err = process.communicate() + retcode = process.poll() + if retcode: + cmd = kwargs.get("args") + if cmd is None: + cmd = popenargs[0] + raise subprocess.CalledProcessError(retcode, cmd, output=output) + return output + + +extra_link_args = check_output( + ["krb5-config", "--libs", "gssapi"], + universal_newlines=True +).split() + +extra_compile_args = check_output( + ["krb5-config", "--cflags", "gssapi"], + universal_newlines=True +).split() + + setup ( name = "pykerberos", version = "1.1.4", @@ -42,8 +66,8 @@ setup ( ext_modules = [ Extension( "kerberos", - extra_link_args = subprocess.check_output(["krb5-config", "--libs", "gssapi"], universal_newlines=True).split(), - extra_compile_args = subprocess.check_output(["krb5-config", "--cflags", "gssapi"], universal_newlines=True).split(), + extra_link_args = extra_link_args, + extra_compile_args = extra_compile_args, sources = [ "src/kerberos.c", "src/kerberosbasic.c",
0
99ea78b1ff77b679665a9c8f9b0bfe3b456d183d
02strich
pykerberos
Incrementing version
commit 99ea78b1ff77b679665a9c8f9b0bfe3b456d183d Author: Stefan Richter <[email protected]> Date: Mon May 18 21:21:38 2015 -0700 Incrementing version diff --git a/setup.py b/setup.py index 3263c2c..ad6c693 100644 --- a/setup.py +++ b/setup.py @@ -56,7 +56,7 @@ if krb5_ver: setup ( name = "pykerberos", - version = "1.1.6", + version = "1.1.7", description = "High-level interface to Kerberos", long_description=long_description, license="ASL 2.0",
0
fed78cf6f7cd80e140f760d8fd3a6eaa39df9669
02strich
pykerberos
Merge pull request #31 from clan/master obviously, verify shouldn't be const
commit fed78cf6f7cd80e140f760d8fd3a6eaa39df9669 Merge: 8d69f80 873fca9 Author: Stefan Richter <[email protected]> Date: Wed Aug 16 22:41:50 2017 -0700 Merge pull request #31 from clan/master obviously, verify shouldn't be const
0
c17f0ba0df0164f788bbb0e1560aa3404f3df521
02strich
pykerberos
Fix reference to undefined command_name variable In setup.py check_krb5_config checks for 'command_name' in kwargs and sets cmd to that value or falls back to 'krb5-config'. If there is an error when trying to run either of those commands it checks an undefined command_name variable. It should be checking cmd instead.
commit c17f0ba0df0164f788bbb0e1560aa3404f3df521 Author: Andrew Laski <[email protected]> Date: Fri May 27 14:07:40 2016 -0400 Fix reference to undefined command_name variable In setup.py check_krb5_config checks for 'command_name' in kwargs and sets cmd to that value or falls back to 'krb5-config'. If there is an error when trying to run either of those commands it checks an undefined command_name variable. It should be checking cmd instead. diff --git a/setup.py b/setup.py index 9b0ee60..763ed3e 100644 --- a/setup.py +++ b/setup.py @@ -36,7 +36,7 @@ def check_krb5_config(*options, **kwargs): raise subprocess.CalledProcessError(retcode, cmd, output=output) return output.split() except OSError as e: - if e.errno == 2 and command_name != "krb5-config.mit": + if e.errno == 2 and cmd != "krb5-config.mit": try: return check_krb5_config(*options, command_name="krb5-config.mit") except OSError as e2:
0
388d0e6d391482ea8e8691efef8ef89774e6eede
02strich
pykerberos
Added missing error messge
commit 388d0e6d391482ea8e8691efef8ef89774e6eede Author: Alexey Veklov <[email protected]> Date: Wed Jan 25 07:43:32 2017 -0500 Added missing error messge diff --git a/src/kerberos.c b/src/kerberos.c index 23a2769..98d8ce0 100644 --- a/src/kerberos.c +++ b/src/kerberos.c @@ -143,6 +143,7 @@ static PyObject* authGSSClientInit(PyObject* self, PyObject* args, PyObject* key } mech_oid = PyGet(pymech_oid, gss_OID_desc); if (mech_oid == NULL) { + PyErr_SetString(PyExc_TypeError, "Invalid value for mech_oid"); return NULL; } }
0
53afda0151576bdc7cd1abc3a09b3782f7997b07
02strich
pykerberos
Add deb packaging
commit 53afda0151576bdc7cd1abc3a09b3782f7997b07 Author: Ben Gamble <[email protected]> Date: Thu Jan 31 00:34:56 2013 +0000 Add deb packaging diff --git a/debian/.svn/entries b/debian/.svn/entries new file mode 100644 index 0000000..b5a3a9a --- /dev/null +++ b/debian/.svn/entries @@ -0,0 +1,84 @@ +10 + +dir +0 +http://svn.calendarserver.org/repository/calendarserver/PyKerberos/trunk/debian +http://svn.calendarserver.org/repository/calendarserver +add + + + + + + + + + + + + + + + + + + + +e27351fd-9f3e-4f54-a53b-843176b1656c + +changelog +file + + + +add + +copyright +file + + + +add + +docs +file + + + +add + +rules +file + + + +add + + + + + +has-props +has-prop-mods + +examples +file + + + +add + +control +file + + + +add + +compat +file + + + +add + diff --git a/debian/.svn/props/rules.svn-work b/debian/.svn/props/rules.svn-work new file mode 100644 index 0000000..869ac71 --- /dev/null +++ b/debian/.svn/props/rules.svn-work @@ -0,0 +1,5 @@ +K 14 +svn:executable +V 1 +* +END diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..8211d3f --- /dev/null +++ b/debian/changelog @@ -0,0 +1,11 @@ +kerberos (1.1.2~SNAPSHOT-1) unstable; urgency=low + + * develop working deb package metadata + + -- Ben Gamble <[email protected]> Tue, 06 Nov 2012 19:48:39 +0000 + +kerberos (1.1.1-1) unstable; urgency=low + + * source package automatically created by stdeb 0.6.0+git + + -- Ben Gamble <[email protected]> Tue, 06 Nov 2012 19:48:39 +0000 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..7f8f011 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +7 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..eaff759 --- /dev/null +++ b/debian/control @@ -0,0 +1,19 @@ +Source: kerberos +Maintainer: Calendarserver Maintainers <[email protected]> +Section: python +Priority: optional +Build-Depends: python-all-dev (>= 2.6.6-3), debhelper (>= 7) +Standards-Version: 3.9.3 + +Package: python-kerberos +Architecture: any +Depends: ${misc:Depends}, ${python:Depends}, ${shlibs:Depends} +Description: Kerberos high-level interface + . + This Python package is a high-level wrapper for Kerberos (GSSAPI) + operations. The goal is to avoid having to build a module that wraps the + entire Kerberos.framework, and instead offer a limited set of functions + that do what is needed for client/server Kerberos authentication based + on <http://www.ietf.org/rfc/rfc4559.txt>. + . + . diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..46afa4b --- /dev/null +++ b/debian/copyright @@ -0,0 +1,17 @@ +This package was debianized by Ben Gamble <[email protected]> on +Tue, 06 Nov 2012 19:48:39 +0000. + +It was downloaded from http://svn.calendarserver.org/repository/calendarserver/PyKerberos/ + +Upstream Author: Cyrus Daboo <[email protected]> + +Copyright: 2006 Apple Computer, Inc. All rights reserved. + +License: + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +On Debian GNU/Linux systems, the complete text of the Apache License Version +2.0 can be found in `/usr/share/common-licenses/Apache-2.0'. + diff --git a/debian/docs b/debian/docs new file mode 100644 index 0000000..d5456d0 --- /dev/null +++ b/debian/docs @@ -0,0 +1,2 @@ +README.txt +pysrc/kerberos.py diff --git a/debian/examples b/debian/examples new file mode 100644 index 0000000..de45608 --- /dev/null +++ b/debian/examples @@ -0,0 +1 @@ +bin/ftp-gss diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..b4f050d --- /dev/null +++ b/debian/rules @@ -0,0 +1,9 @@ +#!/usr/bin/make -f + +# This file was automatically generated by stdeb 0.6.0+git at +# Tue, 06 Nov 2012 19:48:39 +0000 + +%: + dh $@ --with python2 --buildsystem=python_distutils + +
0
38f9c0068dec2df03f1a03ddf57fb4bda2408984
02strich
pykerberos
Adding life support note to README
commit 38f9c0068dec2df03f1a03ddf57fb4bda2408984 Author: Stefan Richter <[email protected]> Date: Thu Aug 3 20:16:02 2017 -0700 Adding life support note to README diff --git a/README.txt b/README.txt index f248e03..7e0d809 100644 --- a/README.txt +++ b/README.txt @@ -1,3 +1,6 @@ +NOTE: this fork of ccs-kerberos is currently on life support mode as Apple has resumed work on upstream. Please try to use https://pypi.python.org/pypi/kerberos instead of this fork if possible. + + ========================================================= PyKerberos Package
0
c74fce17142b355cb333b05ddb6382ec4fd1c21e
02strich
pykerberos
remove deprecation warning for clean methods arguments can be found in https://github.com/02strich/pykerberos/issues/19
commit c74fce17142b355cb333b05ddb6382ec4fd1c21e Author: Stefan Richter <[email protected]> Date: Sun May 29 22:38:28 2016 -0700 remove deprecation warning for clean methods arguments can be found in https://github.com/02strich/pykerberos/issues/19 diff --git a/pysrc/kerberos.py b/pysrc/kerberos.py index 8eea64f..76079f4 100644 --- a/pysrc/kerberos.py +++ b/pysrc/kerberos.py @@ -120,8 +120,9 @@ def authGSSClientInit(service, principal=None, gssflags=GSS_C_MUTUAL_FLAG|GSS_C_ def authGSSClientClean(context): """ - Destroys the context for GSSAPI client-side authentication. After this call the context - object is invalid and should not be used again. + Destroys the context for GSSAPI client-side authentication. This function is provided for API + compatibility with original pykerberos but does nothing. The context object destroys itself + when it is reclaimed. @param context: the context object returned from authGSSClientInit. @return: a result code (see above). @@ -193,8 +194,9 @@ def authGSSServerInit(service): def authGSSServerClean(context): """ - Destroys the context for GSSAPI server-side authentication. After this call the context - object is invalid and should not be used again. + Destroys the context for GSSAPI server-side authentication. This function is provided for API + compatibility with original pykerberos but does nothing. The context object destroys itself + when it is reclaimed. @param context: the context object returned from authGSSServerInit. @return: a result code (see above). diff --git a/src/kerberos.c b/src/kerberos.c index 0c21553..53e6941 100644 --- a/src/kerberos.c +++ b/src/kerberos.c @@ -140,7 +140,6 @@ static PyObject* authGSSClientInit(PyObject* self, PyObject* args, PyObject* key } static PyObject *authGSSClientClean(PyObject *self, PyObject *args) { - PyErr_WarnEx(PyExc_RuntimeError, "kerberos.authGSSClientClean is deprecated.", 2); return Py_BuildValue("i", AUTH_GSS_COMPLETE); } @@ -393,7 +392,6 @@ static PyObject *authGSSServerInit(PyObject *self, PyObject *args) { } static PyObject *authGSSServerClean(PyObject *self, PyObject *args) { - PyErr_WarnEx(PyExc_RuntimeError, "kerberos.authGSSServerClean is deprecated.", 2); return Py_BuildValue("i", AUTH_GSS_COMPLETE); }
0
29d13da55ab2d5cb79161a3dbb8da45cd7a46d57
02strich
pykerberos
Increment version to 1.1.5 for new PyPi release including Python 2.6 compat
commit 29d13da55ab2d5cb79161a3dbb8da45cd7a46d57 Author: Stefan Richter <[email protected]> Date: Tue Mar 25 10:27:25 2014 +0100 Increment version to 1.1.5 for new PyPi release including Python 2.6 compat diff --git a/setup.py b/setup.py index 8ad1dc4..edccc54 100644 --- a/setup.py +++ b/setup.py @@ -52,7 +52,7 @@ extra_compile_args = check_output( setup ( name = "pykerberos", - version = "1.1.4", + version = "1.1.5", description = "High-level interface to Kerberos", long_description=long_description, license="ASL 2.0",
0
3fbc6f3fd6f41d4186489f75bed27a6426cc5e4b
02strich
pykerberos
migrate to destructors
commit 3fbc6f3fd6f41d4186489f75bed27a6426cc5e4b Author: Stefan Richter <[email protected]> Date: Sun Nov 8 21:07:27 2015 -0800 migrate to destructors diff --git a/src/kerberos.c b/src/kerberos.c index 0a18786..ff75dee 100644 --- a/src/kerberos.c +++ b/src/kerberos.c @@ -23,12 +23,12 @@ #if PY_MAJOR_VERSION >= 3 #define PyInt_FromLong PyLong_FromLong - #define PyNew(object) PyCapsule_New(object, NULL, NULL) + #define PyNew(object, destr) PyCapsule_New(object, NULL, destr) #define PyCheck(object) PyCapsule_CheckExact(object) #define PyGet(object, type) PyCapsule_GetPointer(object, NULL) #define PyClear(object) PyCapsule_SetPointer(object, NULL) #else - #define PyNew(object) PyCObject_FromVoidPtr(object, NULL) + #define PyNew(object, destr) PyCObject_FromVoidPtr(object, destr) #define PyCheck(object) PyCObject_Check(object) #define PyGet(object, type) (type *)PyCObject_AsVoidPtr(object) #define PyClear(object) PyCObject_SetVoidPtr(object, NULL) @@ -99,6 +99,22 @@ static PyObject *getServerPrincipalDetails(PyObject *self, PyObject *args) { } } +#if PY_MAJOR_VERSION >= 3 +void destruct_client(PyObject* o) { + gss_client_state *state; + state = PyCapsule_GetPointer(o, NULL); +#else +void destruct_client(void* o) { + gss_client_state *state; + state = (gss_client_state *)o; +#endif + + if (state != NULL) { + authenticate_gss_client_clean(state); + free(state); + } +} + static PyObject* authGSSClientInit(PyObject* self, PyObject* args, PyObject* keywds) { const char *service = NULL; const char *principal = NULL; @@ -113,7 +129,7 @@ static PyObject* authGSSClientInit(PyObject* self, PyObject* args, PyObject* key } state = (gss_client_state *) malloc(sizeof(gss_client_state)); - pystate = PyNew(state); + pystate = PyNew(state, &destruct_client); result = authenticate_gss_client_init(service, principal, gss_flags, state); if (result == AUTH_GSS_ERROR) { @@ -124,28 +140,10 @@ static PyObject* authGSSClientInit(PyObject* self, PyObject* args, PyObject* key } static PyObject *authGSSClientClean(PyObject *self, PyObject *args) { - gss_client_state *state; - PyObject *pystate; - int result = 0; - - if (!PyArg_ParseTuple(args, "O", &pystate)) { - return NULL; - } - - if (!PyCheck(pystate)) { - PyErr_SetString(PyExc_TypeError, "Expected a context object"); - return NULL; - } - - state = PyGet(pystate, gss_client_state); - if (state != NULL) { - result = authenticate_gss_client_clean(state); - - free(state); - PyClear(pystate); - } - - return Py_BuildValue("i", result); +#if PY_MAJOR_VERSION >= 3 + PyErr_WarnEx(PyExc_RuntimeError, "kerberos.authGSSClientClean is deprecated.", 2); + return Py_BuildValue("i", AUTH_GSS_COMPLETE); +#endif } static PyObject *authGSSClientStep(PyObject *self, PyObject *args) { @@ -359,6 +357,22 @@ static PyObject *authGSSClientWrapIov(PyObject *self, PyObject *args) { } #endif +#if PY_MAJOR_VERSION >= 3 +void destruct_server(PyObject* o) { + gss_server_state *state; + state = PyCapsule_GetPointer(o, NULL); +#else +void destruct_server(void* o) { + gss_server_state *state; + state = (gss_server_state *)o; +#endif + + if (state != NULL) { + authenticate_gss_server_clean(state); + free(state); + } +} + static PyObject *authGSSServerInit(PyObject *self, PyObject *args) { const char *service = NULL; gss_server_state *state; @@ -370,7 +384,7 @@ static PyObject *authGSSServerInit(PyObject *self, PyObject *args) { } state = (gss_server_state *) malloc(sizeof(gss_server_state)); - pystate = PyNew(state); + pystate = PyNew(state, &destruct_server); result = authenticate_gss_server_init(service, state); if (result == AUTH_GSS_ERROR) { @@ -381,28 +395,9 @@ static PyObject *authGSSServerInit(PyObject *self, PyObject *args) { } static PyObject *authGSSServerClean(PyObject *self, PyObject *args) { - gss_server_state *state; - PyObject *pystate; - int result = 0; - - if (!PyArg_ParseTuple(args, "O", &pystate)) { - return NULL; - } - - if (!PyCheck(pystate)) { - PyErr_SetString(PyExc_TypeError, "Expected a context object"); - return NULL; - } - - state = PyGet(pystate, gss_server_state); - if (state != NULL) { - result = authenticate_gss_server_clean(state); - - free(state); - PyClear(pystate); - } - - return Py_BuildValue("i", result); +#if PY_MAJOR_VERSION >= 3 + PyErr_WarnEx(PyExc_RuntimeError, "kerberos.authGSSServerClean is deprecated.", 2); + return Py_BuildValue("i", AUTH_GSS_COMPLETE); } static PyObject *authGSSServerStep(PyObject *self, PyObject *args) {
0
8fe82143b4aad4effa0f994644323efb4198b239
02strich
pykerberos
bump dev version to 0.13.0.dev0
commit 8fe82143b4aad4effa0f994644323efb4198b239 Author: Matt Davis <[email protected]> Date: Wed Dec 20 11:39:30 2017 -0800 bump dev version to 0.13.0.dev0 diff --git a/setup.py b/setup.py index 1bac8ef..6542a44 100644 --- a/setup.py +++ b/setup.py @@ -58,7 +58,7 @@ if krb5_ver: setup ( name = "pykerberos", - version = "1.2.1", + version = "1.2.2.dev0", description = "High-level interface to Kerberos", long_description=long_description, license="ASL 2.0",
0
9c76191412cc1980b575a14d8a580dee19799fde
02strich
pykerberos
debian release metadata
commit 9c76191412cc1980b575a14d8a580dee19799fde Author: Ben Gamble <[email protected]> Date: Thu Jan 31 11:57:52 2013 +0000 debian release metadata diff --git a/debian/changelog b/debian/changelog index 8211d3f..05f1f31 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,8 @@ -kerberos (1.1.2~SNAPSHOT-1) unstable; urgency=low +kerberos (1.1.2+DSE1-1) unstable; urgency=low - * develop working deb package metadata + * Fix SASL QOP negotiation ([email protected]) - -- Ben Gamble <[email protected]> Tue, 06 Nov 2012 19:48:39 +0000 + -- Ben Gamble <[email protected]> Thu, 31 Jan 2013 11:26:46 +0000 kerberos (1.1.1-1) unstable; urgency=low
0
769b93fc030ecb886249a89f45e01c5518248e29
02strich
pykerberos
Added option for setting gss mech oid (port of https://github.com/apple/ccs-pykerberos/issues/47). Set version to 1.1.14
commit 769b93fc030ecb886249a89f45e01c5518248e29 Author: Alexey Veklov <[email protected]> Date: Fri Jan 20 12:54:59 2017 -0500 Added option for setting gss mech oid (port of https://github.com/apple/ccs-pykerberos/issues/47). Set version to 1.1.14 diff --git a/.gitignore b/.gitignore index 1e9721c..8529c0e 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ debian/*.substvars debian/files pykerberos.egg-info/ /kerberos.so +.idea \ No newline at end of file diff --git a/pysrc/kerberos.py b/pysrc/kerberos.py index 76079f4..7a708c9 100644 --- a/pysrc/kerberos.py +++ b/pysrc/kerberos.py @@ -101,7 +101,7 @@ GSS_C_ANON_FLAG = 64 GSS_C_PROT_READY_FLAG = 128 GSS_C_TRANS_FLAG = 256 -def authGSSClientInit(service, principal=None, gssflags=GSS_C_MUTUAL_FLAG|GSS_C_SEQUENCE_FLAG): +def authGSSClientInit(service, principal=None, gssflags=GSS_C_MUTUAL_FLAG|GSS_C_SEQUENCE_FLAG, mech_oid=None): """ Initializes a context for GSSAPI client-side authentication with the given service principal. authGSSClientClean must be called after this function returns an OK result to dispose of @@ -114,6 +114,8 @@ def authGSSClientInit(service, principal=None, gssflags=GSS_C_MUTUAL_FLAG|GSS_C_ @param gssflags: optional integer used to set GSS flags. (e.g. GSS_C_DELEG_FLAG|GSS_C_MUTUAL_FLAG|GSS_C_SEQUENCE_FLAG will allow for forwarding credentials to the remote host) + @param mech_oid: Optional GSS mech OID. Defaults to None (GSS_C_NO_OID). + Other possible values are GSS_MECH_OID_KRB5, GSS_MECH_OID_SPNEGO. @return: a tuple of (result, context) where result is the result code (see above) and context is an opaque value that will need to be passed to subsequent functions. """ diff --git a/setup.py b/setup.py index 1e95410..6ae96d3 100644 --- a/setup.py +++ b/setup.py @@ -58,7 +58,7 @@ if krb5_ver: setup ( name = "pykerberos", - version = "1.1.13", + version = "1.1.14", description = "High-level interface to Kerberos", long_description=long_description, license="ASL 2.0", diff --git a/src/kerberos.c b/src/kerberos.c index 53e6941..03538ef 100644 --- a/src/kerberos.c +++ b/src/kerberos.c @@ -34,6 +34,12 @@ #define PyClear(object) PyCObject_SetVoidPtr(object, NULL) #endif +static char krb5_mech_oid_bytes [] = "\x2a\x86\x48\x86\xf7\x12\x01\x02\x02"; +gss_OID_desc krb5_mech_oid = { 9, &krb5_mech_oid_bytes }; + +static char spnego_mech_oid_bytes[] = "\x2b\x06\x01\x05\x05\x02"; +gss_OID_desc spnego_mech_oid = { 6, &spnego_mech_oid_bytes }; + PyObject *KrbException_class; PyObject *BasicAuthException_class; PyObject *PwdChangeException_class; @@ -120,18 +126,25 @@ static PyObject* authGSSClientInit(PyObject* self, PyObject* args, PyObject* key const char *principal = NULL; gss_client_state *state; PyObject *pystate; - static char *kwlist[] = {"service", "principal", "gssflags", NULL}; + gss_OID mech_oid = GSS_C_NO_OID; + PyObject *pymech_oid = NULL; + static char *kwlist[] = {"service", "principal", "gssflags", "mech_oid", NULL}; long int gss_flags = GSS_C_MUTUAL_FLAG | GSS_C_SEQUENCE_FLAG; int result = 0; - if (!PyArg_ParseTupleAndKeywords(args, keywds, "s|zl", kwlist, &service, &principal, &gss_flags)) { + if (!PyArg_ParseTupleAndKeywords(args, keywds, "s|zlO", kwlist, &service, &principal, &gss_flags, &pymech_oid)) { return NULL; } + if (pymech_oid != NULL && PyCapsule_CheckExact(pymech_oid)) { + const char * mech_oid_name = PyCapsule_GetName(pymech_oid); + mech_oid = PyCapsule_GetPointer(pymech_oid, mech_oid_name); + } + state = (gss_client_state *) malloc(sizeof(gss_client_state)); pystate = PyNew(state, &destruct_client); - result = authenticate_gss_client_init(service, principal, gss_flags, state); + result = authenticate_gss_client_init(service, principal, gss_flags, mech_oid, state); if (result == AUTH_GSS_ERROR) { return NULL; } @@ -597,6 +610,8 @@ void initkerberos(void) PyDict_SetItemString(d, "GSS_C_ANON_FLAG", PyInt_FromLong(GSS_C_ANON_FLAG)); PyDict_SetItemString(d, "GSS_C_PROT_READY_FLAG", PyInt_FromLong(GSS_C_PROT_READY_FLAG)); PyDict_SetItemString(d, "GSS_C_TRANS_FLAG", PyInt_FromLong(GSS_C_TRANS_FLAG)); + PyDict_SetItemString(d, "GSS_MECH_OID_KRB5", PyCapsule_New(&krb5_mech_oid, "kerberos.GSS_MECH_OID_KRB5", NULL)); + PyDict_SetItemString(d, "GSS_MECH_OID_SPNEGO", PyCapsule_New(&spnego_mech_oid, "kerberos.GSS_MECH_OID_SPNEGO", NULL)); error: if (PyErr_Occurred()) diff --git a/src/kerberosgss.c b/src/kerberosgss.c index 5b12f71..20a46e7 100644 --- a/src/kerberosgss.c +++ b/src/kerberosgss.c @@ -106,7 +106,7 @@ end: return result; } -int authenticate_gss_client_init(const char* service, const char* principal, long int gss_flags, gss_client_state* state) +int authenticate_gss_client_init(const char* service, const char* principal, long int gss_flags, gss_OID mech_oid, gss_client_state* state) { OM_uint32 maj_stat; OM_uint32 min_stat; @@ -116,6 +116,7 @@ int authenticate_gss_client_init(const char* service, const char* principal, lon gss_OID mech; state->server_name = GSS_C_NO_NAME; + state->mech_oid = mech_oid; state->context = GSS_C_NO_CONTEXT; state->gss_flags = gss_flags; state->client_creds = GSS_C_NO_CREDENTIAL; @@ -234,7 +235,7 @@ int authenticate_gss_client_step(gss_client_state* state, const char* challenge) state->client_creds, &state->context, state->server_name, - GSS_C_NO_OID, + state->mech_oid, (OM_uint32)state->gss_flags, 0, NULL, //GSS_C_NO_CHANNEL_BINDINGS, diff --git a/src/kerberosgss.h b/src/kerberosgss.h index 8b5e57c..f19b24e 100644 --- a/src/kerberosgss.h +++ b/src/kerberosgss.h @@ -33,6 +33,7 @@ typedef struct { gss_ctx_id_t context; gss_name_t server_name; + gss_OID mech_oid; long int gss_flags; gss_cred_id_t client_creds; char* username; @@ -53,7 +54,7 @@ typedef struct { char* server_principal_details(const char* service, const char* hostname); -int authenticate_gss_client_init(const char* service, const char* principal, long int gss_flags, gss_client_state* state); +int authenticate_gss_client_init(const char* service, const char* principal, long int gss_flags, gss_OID mech_oid, gss_client_state* state); int authenticate_gss_client_clean(gss_client_state *state); int authenticate_gss_client_step(gss_client_state *state, const char *challenge); int authenticate_gss_client_unwrap(gss_client_state* state, const char* challenge); diff --git a/test.py b/test.py index 2d096e5..24f6351 100644 --- a/test.py +++ b/test.py @@ -50,10 +50,11 @@ def main(): host = "host.example.com" realm ="HOST.EXAMPLE.COM" port = 8008 + mech = None use_ssl = False allowedActions = ("service", "basic", "gssapi", "server",) - options, args = getopt.getopt(sys.argv[1:], "u:p:s:h:i:r:x") + options, args = getopt.getopt(sys.argv[1:], "u:p:s:h:i:r:m:x") for option, value in options: if option == "-u": @@ -68,6 +69,8 @@ def main(): port = value elif option == "-r": realm = value + elif option == "-m": + mech = value elif option == "-x": use_ssl = True @@ -83,7 +86,7 @@ def main(): if "service" in actions: print("\n*** Running Service Principal test") s, h = service.split("@") - testServicePrincipal(s, h); + testServicePrincipal(s, h) # GSS Basic test if "basic" in actions: @@ -100,7 +103,7 @@ def main(): if "server" in actions: print("\n*** Running HTTP test") - testHTTP(host, port, use_ssl, service) + testHTTP(host, port, use_ssl, service, mech) print("\n*** Done\n") @@ -129,27 +132,27 @@ def testGSSAPI(service): else: return "Error" - rc, vc = kerberos.authGSSClientInit(service); + rc, vc = kerberos.authGSSClientInit(service) print("Status for authGSSClientInit = %s" % statusText(rc)) if rc != 1: return - rs, vs = kerberos.authGSSServerInit(service); + rs, vs = kerberos.authGSSServerInit(service) print("Status for authGSSServerInit = %s" % statusText(rs)) if rs != 1: return - rc = kerberos.authGSSClientStep(vc, ""); + rc = kerberos.authGSSClientStep(vc, "") print("Status for authGSSClientStep = %s" % statusText(rc)) if rc != 0: return - rs = kerberos.authGSSServerStep(vs, kerberos.authGSSClientResponse(vc)); + rs = kerberos.authGSSServerStep(vs, kerberos.authGSSClientResponse(vc)) print("Status for authGSSServerStep = %s" % statusText(rs)) if rs == -1: return - rc = kerberos.authGSSClientStep(vc, kerberos.authGSSServerResponse(vs)); + rc = kerberos.authGSSClientStep(vc, kerberos.authGSSServerResponse(vs)) print("Status for authGSSClientStep = %s" % statusText(rc)) if rc == -1: return @@ -158,13 +161,13 @@ def testGSSAPI(service): print("Server target name: %s" % kerberos.authGSSServerTargetName(vs)) print("Client user name: %s" % kerberos.authGSSClientUserName(vc)) - rc = kerberos.authGSSClientClean(vc); + rc = kerberos.authGSSClientClean(vc) print("Status for authGSSClientClean = %s" % statusText(rc)) - rs = kerberos.authGSSServerClean(vs); + rs = kerberos.authGSSServerClean(vs) print("Status for authGSSServerClean = %s" % statusText(rs)) -def testHTTP(host, port, use_ssl, service): +def testHTTP(host, port, use_ssl, service, mech): class HTTPSConnection_SSLv3(httplib.HTTPSConnection): "This class allows communication via SSL." @@ -216,13 +219,19 @@ def testHTTP(host, port, use_ssl, service): return try: - rc, vc = kerberos.authGSSClientInit(service=service); + mech_oid = None + if mech and mech.lower() == "krb5": + mech_oid = kerberos.GSS_MECH_OID_KRB5 + elif mech and mech.lower() == "spnego": + mech_oid = kerberos.GSS_MECH_OID_SPNEGO + + rc, vc = kerberos.authGSSClientInit(service=service, mech_oid=mech_oid) except kerberos.GSSError as e: print("Could not initialize GSSAPI: %s/%s" % (e[0][0], e[1][0])) return try: - kerberos.authGSSClientStep(vc, ""); + kerberos.authGSSClientStep(vc, "") except kerberos.GSSError as e: print("Could not do GSSAPI step with continue: %s/%s" % (e[0][0], e[1][0])) return @@ -263,7 +272,7 @@ def testHTTP(host, port, use_ssl, service): return try: - rc = kerberos.authGSSClientClean(vc); + kerberos.authGSSClientClean(vc) except kerberos.GSSError as e: print("Could not clean-up GSSAPI: %s/%s" % (e[0][0], e[1][0])) return
0
ef127e009264265d3e255aaa27ef49910c0c9e28
02strich
pykerberos
http://svn.calendarserver.org/repository/calendarserver/PyKerberos/trunk @ 10302
commit ef127e009264265d3e255aaa27ef49910c0c9e28 Author: Ben Gamble <[email protected]> Date: Wed Jan 30 22:15:53 2013 +0000 http://svn.calendarserver.org/repository/calendarserver/PyKerberos/trunk @ 10302 diff --git a/.svn/all-wcprops b/.svn/all-wcprops new file mode 100644 index 0000000..ef38ba7 --- /dev/null +++ b/.svn/all-wcprops @@ -0,0 +1,29 @@ +K 25 +svn:wc:ra_dav:version-url +V 58 +/repository/calendarserver/!svn/ver/10302/PyKerberos/trunk +END +LICENSE +K 25 +svn:wc:ra_dav:version-url +V 63 +/repository/calendarserver/!svn/ver/17/PyKerberos/trunk/LICENSE +END +test.py +K 25 +svn:wc:ra_dav:version-url +V 66 +/repository/calendarserver/!svn/ver/10302/PyKerberos/trunk/test.py +END +setup.py +K 25 +svn:wc:ra_dav:version-url +V 67 +/repository/calendarserver/!svn/ver/10302/PyKerberos/trunk/setup.py +END +README.txt +K 25 +svn:wc:ra_dav:version-url +V 69 +/repository/calendarserver/!svn/ver/10302/PyKerberos/trunk/README.txt +END diff --git a/.svn/dir-prop-base b/.svn/dir-prop-base new file mode 100644 index 0000000..8ae4f04 --- /dev/null +++ b/.svn/dir-prop-base @@ -0,0 +1,8 @@ +K 10 +svn:ignore +V 29 +build +.project +.pydevproject + +END diff --git a/.svn/entries b/.svn/entries new file mode 100644 index 0000000..6071afd --- /dev/null +++ b/.svn/entries @@ -0,0 +1,179 @@ +10 + +dir +10603 +http://svn.calendarserver.org/repository/calendarserver/PyKerberos/trunk +http://svn.calendarserver.org/repository/calendarserver + + + +2013-01-15T00:00:30.229472Z +10302 [email protected] +has-props + + + + + + + + + + + + + +e27351fd-9f3e-4f54-a53b-843176b1656c + +pysrc +dir + +LICENSE +file + + + + +2013-01-30T21:54:22.000000Z +3b83ef96387f14655fc854ddc3c6bd57 +2006-08-04T18:11:12.581151Z +17 [email protected] + + + + + + + + + + + + + + + + + + + + + +11358 + +config +dir + +test.py +file + + + + +2013-01-30T21:54:22.000000Z +daf2874ae131353952b1828992fb81dc +2013-01-15T00:00:30.229472Z +10302 [email protected] + + + + + + + + + + + + + + + + + + + + + +8365 + +src +dir + +setup.py +file + + + + +2013-01-30T21:54:22.000000Z +a167aabf0f760daef6f9dff8ac37e100 +2013-01-15T00:00:30.229472Z +10302 [email protected] + + + + + + + + + + + + + + + + + + + + + +1946 + +bin +dir + +README.txt +file + + + + +2013-01-30T21:54:22.000000Z +1becbb513c18a9b8fa95d1feff99e9cd +2013-01-15T00:00:30.229472Z +10302 [email protected] + + + + + + + + + + + + + + + + + + + + + +2525 + +support +dir + diff --git a/.svn/text-base/LICENSE.svn-base b/.svn/text-base/LICENSE.svn-base new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/.svn/text-base/LICENSE.svn-base @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/.svn/text-base/README.txt.svn-base b/.svn/text-base/README.txt.svn-base new file mode 100644 index 0000000..f248e03 --- /dev/null +++ b/.svn/text-base/README.txt.svn-base @@ -0,0 +1,69 @@ +========================================================= +PyKerberos Package + +Copyright (c) 2006-2013 Apple Inc. All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +========================================================= + +This Python package is a high-level wrapper for Kerberos (GSSAPI) operations. +The goal is to avoid having to build a module that wraps the entire Kerberos.framework, +and instead offer a limited set of functions that do what is needed for client/server +Kerberos authentication based on <http://www.ietf.org/rfc/rfc4559.txt>. + +Much of the C-code here is adapted from Apache's mod_auth_kerb-5.0rc7. + +======== +CONTENTS +======== + + src/ : directory in which C source code resides. + setup.py : Python distutils extension build script. + config/ : directory of useful Kerberos config files. + edu.mit.Kerberos : example Kerberos .ini file. + README.txt : this file! + kerberos.py : Python api documentation/stub implementation. + +===== +BUILD +===== + +In this directory, run: + + python setup.py build + +======= +TESTING +======= + +You must have a valid Kerberos setup on the test machine and you should ensure that you have valid +Kerberos tickets for any client authentication being done (run 'klist' on the command line). +Additionally, for the server: it must have been configured as a valid Kerberos service with the Kerbersos server +for its realm - this usually requires running kadmin on the server machine to add the principal and generate a keytab +entry for it (run 'sudo klist -k' to see the currently available keytab entries). + +Make sure that PYTHONPATH includes the appropriate build/lib.xxxx directory. +Then run test.py with suitable command line arguments: + + python test.py -u userid -p password -s service + + -u : user id for basic authenticate + -p : password for basic authenticate + -s : service principal for GSSAPI authentication (defaults to '[email protected]') + +=========== +Python APIs +=========== + +See kerberos.py. diff --git a/.svn/text-base/setup.py.svn-base b/.svn/text-base/setup.py.svn-base new file mode 100644 index 0000000..166bda4 --- /dev/null +++ b/.svn/text-base/setup.py.svn-base @@ -0,0 +1,54 @@ +## +# Copyright (c) 2006-2013 Apple Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +## + +from distutils.core import setup, Extension +import sys +import commands + +long_description = """ +This Python package is a high-level wrapper for Kerberos (GSSAPI) operations. +The goal is to avoid having to build a module that wraps the entire Kerberos.framework, +and instead offer a limited set of functions that do what is needed for client/server +Kerberos authentication based on <http://www.ietf.org/rfc/rfc4559.txt>. + +""" + +setup ( + name = "kerberos", + version = "1.1.1", + description = "Kerberos high-level interface", + long_description=long_description, + classifiers = [ + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python :: 2", + "Topic :: Software Development :: Libraries :: Python Modules", + "Topic :: System :: Systems Administration :: Authentication/Directory" + ], + ext_modules = [ + Extension( + "kerberos", + extra_link_args = commands.getoutput("krb5-config --libs gssapi").split(), + extra_compile_args = commands.getoutput("krb5-config --cflags gssapi").split(), + sources = [ + "src/kerberos.c", + "src/kerberosbasic.c", + "src/kerberosgss.c", + "src/kerberospw.c", + "src/base64.c" + ], + ), + ], +) diff --git a/.svn/text-base/test.py.svn-base b/.svn/text-base/test.py.svn-base new file mode 100644 index 0000000..eaae467 --- /dev/null +++ b/.svn/text-base/test.py.svn-base @@ -0,0 +1,272 @@ +#!/usr/bin/env python +## +# Copyright (c) 2006-2013 Apple Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +## + +import kerberos +import getopt +import sys +import httplib +import socket +import ssl + +""" +Examples: + +sudo ./test.py -s [email protected] service + +sudo ./test.py -u user01 -p user01 -s [email protected] -r EXAMPLE.COM basic + +sudo ./test.py -s [email protected] -r EXAMPLE.COM gssapi + +./test.py -s [email protected] -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 + user = "" + pswd = "" + service = "[email protected]" + host = "host.example.com" + realm ="HOST.EXAMPLE.COM" + port = 8008 + use_ssl = False + allowedActions = ("service", "basic", "gssapi", "server",) + + options, args = getopt.getopt(sys.argv[1:], "u:p:s:h:i:r:x") + + for option, value in options: + if option == "-u": + user = value + elif option == "-p": + pswd = value + elif option == "-s": + service = value + elif option == "-h": + host = value + elif option == "-i": + port = value + elif option == "-r": + realm = value + elif option == "-x": + use_ssl = True + + actions = set() + for arg in args: + if arg in allowedActions: + actions.add(arg) + else: + print "Action not allowed: %s" % (arg,) + sys.exit(1) + + # Get service principal + if "service" in actions: + print "\n*** Running Service Principal test" + s, h = service.split("@") + testServicePrincipal(s, h); + + # GSS Basic test + if "basic" in actions: + if (len(user) != 0) and (len(pswd) != 0): + print "\n*** Running basic test" + testCheckpassword(user, pswd, service, realm) + else: + print "\n*** Skipping basic test: no user or password specified" + + # Full GSSAPI test + if "gssapi" in actions: + print "\n*** Running GSSAPI test" + testGSSAPI(service) + + if "server" in actions: + print "\n*** Running HTTP test" + testHTTP(host, port, use_ssl, service) + + print "\n*** Done\n" + +def testServicePrincipal(service, hostname): + try: + result = kerberos.getServerPrincipalDetails(service, hostname) + except kerberos.KrbError, e: + print "Kerberos service principal for %s/%s failed: %s" % (service, hostname, e[0]) + else: + print "Kerberos service principal for %s/%s succeeded: %s" % (service, hostname, result) + +def testCheckpassword(user, pswd, service, realm): + try: + kerberos.checkPassword(user, pswd, service, realm) + except kerberos.BasicAuthError, e: + print "Kerberos authentication for %s failed: %s" % (user, e[0]) + else: + print "Kerberos authentication for %s succeeded" % user + +def testGSSAPI(service): + def statusText(r): + if r == 1: + return "Complete" + elif r == 0: + return "Continue" + else: + return "Error" + + rc, vc = kerberos.authGSSClientInit(service); + print "Status for authGSSClientInit = %s" % statusText(rc); + if rc != 1: + return + + rs, vs = kerberos.authGSSServerInit(service); + print "Status for authGSSServerInit = %s" % statusText(rs); + if rs != 1: + return + + rc = kerberos.authGSSClientStep(vc, ""); + print "Status for authGSSClientStep = %s" % statusText(rc); + if rc != 0: + return + + rs = kerberos.authGSSServerStep(vs, kerberos.authGSSClientResponse(vc)); + print "Status for authGSSServerStep = %s" % statusText(rs); + if rs == -1: + return + + rc = kerberos.authGSSClientStep(vc, kerberos.authGSSServerResponse(vs)); + print "Status for authGSSClientStep = %s" % statusText(rc); + if rc == -1: + return + + print "Server user name: %s" % kerberos.authGSSServerUserName(vs); + print "Server target name: %s" % kerberos.authGSSServerTargetName(vs); + print "Client user name: %s" % kerberos.authGSSClientUserName(vc); + + rc = kerberos.authGSSClientClean(vc); + print "Status for authGSSClientClean = %s" % statusText(rc); + + rs = kerberos.authGSSServerClean(vs); + print "Status for authGSSServerClean = %s" % statusText(rs); + +def testHTTP(host, port, use_ssl, service): + + class HTTPSConnection_SSLv3(httplib.HTTPSConnection): + "This class allows communication via SSL." + + def connect(self): + "Connect to a host on a given (SSL) port." + + sock = socket.create_connection((self.host, self.port), self.timeout) + self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file, ssl_version=ssl.PROTOCOL_SSLv3) + + def sendRequest(host, port, ssl, method, uri, headers): + response = None + if use_ssl: + http = HTTPSConnection_SSLv3(host, port) + else: + http = httplib.HTTPConnection(host, port) + try: + http.request(method, uri, "", headers) + response = http.getresponse() + finally: + http.close() + + return response + + # Initial request without auth header + uri = "/principals/" + response = sendRequest(host, port, use_ssl, "OPTIONS", uri, {}) + + if response is None: + print "Initial HTTP request to server failed" + return + + if response.status != 401: + print "Initial HTTP request did not result in a 401 response" + return + + hdrs = response.msg.getheaders("www-authenticate") + if (hdrs is None) or (len(hdrs) == 0): + print "No www-authenticate header in initial HTTP response." + for hdr in hdrs: + hdr = hdr.strip() + splits = hdr.split(' ', 1) + if (len(splits) != 1) or (splits[0].lower() != "negotiate"): + continue + else: + break + else: + print "No www-authenticate header with negotiate in initial HTTP response." + return + + try: + rc, vc = kerberos.authGSSClientInit(service=service); + except kerberos.GSSError, e: + print "Could not initialize GSSAPI: %s/%s" % (e[0][0], e[1][0]) + return + + try: + kerberos.authGSSClientStep(vc, ""); + except kerberos.GSSError, e: + print "Could not do GSSAPI step with continue: %s/%s" % (e[0][0], e[1][0]) + return + + hdrs = {} + hdrs["Authorization"] = "negotiate %s" % kerberos.authGSSClientResponse(vc) + + # Second request with auth header + response = sendRequest(host, port, use_ssl, "OPTIONS", uri, hdrs) + + if response is None: + print "Second HTTP request to server failed" + return + + if response.status/100 != 2: + print "Second HTTP request did not result in a 2xx response: %d" % (response.status,) + return + + hdrs = response.msg.getheaders("www-authenticate") + if (hdrs is None) or (len(hdrs) == 0): + print "No www-authenticate header in second HTTP response." + return + for hdr in hdrs: + hdr = hdr.strip() + splits = hdr.split(' ', 1) + if (len(splits) != 2) or (splits[0].lower() != "negotiate"): + continue + else: + break + else: + print "No www-authenticate header with negotiate in second HTTP response." + return + + try: + kerberos.authGSSClientStep(vc, splits[1]) + except kerberos.GSSError, e: + print "Could not verify server www-authenticate header in second HTTP response: %s/%s" % (e[0][0], e[1][0]) + return + + try: + rc = kerberos.authGSSClientClean(vc); + except kerberos.GSSError, e: + print "Could not clean-up GSSAPI: %s/%s" % (e[0][0], e[1][0]) + return + + print "Authenticated successfully" + return + +if __name__=='__main__': + main() diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..f248e03 --- /dev/null +++ b/README.txt @@ -0,0 +1,69 @@ +========================================================= +PyKerberos Package + +Copyright (c) 2006-2013 Apple Inc. All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +========================================================= + +This Python package is a high-level wrapper for Kerberos (GSSAPI) operations. +The goal is to avoid having to build a module that wraps the entire Kerberos.framework, +and instead offer a limited set of functions that do what is needed for client/server +Kerberos authentication based on <http://www.ietf.org/rfc/rfc4559.txt>. + +Much of the C-code here is adapted from Apache's mod_auth_kerb-5.0rc7. + +======== +CONTENTS +======== + + src/ : directory in which C source code resides. + setup.py : Python distutils extension build script. + config/ : directory of useful Kerberos config files. + edu.mit.Kerberos : example Kerberos .ini file. + README.txt : this file! + kerberos.py : Python api documentation/stub implementation. + +===== +BUILD +===== + +In this directory, run: + + python setup.py build + +======= +TESTING +======= + +You must have a valid Kerberos setup on the test machine and you should ensure that you have valid +Kerberos tickets for any client authentication being done (run 'klist' on the command line). +Additionally, for the server: it must have been configured as a valid Kerberos service with the Kerbersos server +for its realm - this usually requires running kadmin on the server machine to add the principal and generate a keytab +entry for it (run 'sudo klist -k' to see the currently available keytab entries). + +Make sure that PYTHONPATH includes the appropriate build/lib.xxxx directory. +Then run test.py with suitable command line arguments: + + python test.py -u userid -p password -s service + + -u : user id for basic authenticate + -p : password for basic authenticate + -s : service principal for GSSAPI authentication (defaults to '[email protected]') + +=========== +Python APIs +=========== + +See kerberos.py. diff --git a/bin/.svn/all-wcprops b/bin/.svn/all-wcprops new file mode 100644 index 0000000..9178a33 --- /dev/null +++ b/bin/.svn/all-wcprops @@ -0,0 +1,11 @@ +K 25 +svn:wc:ra_dav:version-url +V 61 +/repository/calendarserver/!svn/ver/2726/PyKerberos/trunk/bin +END +ftp-gss +K 25 +svn:wc:ra_dav:version-url +V 69 +/repository/calendarserver/!svn/ver/2726/PyKerberos/trunk/bin/ftp-gss +END diff --git a/bin/.svn/entries b/bin/.svn/entries new file mode 100644 index 0000000..3e5ad6d --- /dev/null +++ b/bin/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +10603 +http://svn.calendarserver.org/repository/calendarserver/PyKerberos/trunk/bin +http://svn.calendarserver.org/repository/calendarserver + + + +2008-07-18T16:41:09.140492Z +2726 [email protected] + + + + + + + + + + + + + + +e27351fd-9f3e-4f54-a53b-843176b1656c + +ftp-gss +file + + + + +2013-01-30T21:54:22.000000Z +1bfd38c9fc1ee51793df8669fb1fd842 +2008-07-18T16:41:09.140492Z +2726 [email protected] +has-props + + + + + + + + + + + + + + + + + + + + +4282 + diff --git a/bin/.svn/prop-base/ftp-gss.svn-base b/bin/.svn/prop-base/ftp-gss.svn-base new file mode 100644 index 0000000..869ac71 --- /dev/null +++ b/bin/.svn/prop-base/ftp-gss.svn-base @@ -0,0 +1,5 @@ +K 14 +svn:executable +V 1 +* +END diff --git a/bin/.svn/text-base/ftp-gss.svn-base b/bin/.svn/text-base/ftp-gss.svn-base new file mode 100644 index 0000000..62a6249 --- /dev/null +++ b/bin/.svn/text-base/ftp-gss.svn-base @@ -0,0 +1,137 @@ +#!/usr/bin/env python +## +# Copyright (c) 2008 Jelmer Vernooij <[email protected]> +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Support for secure authentication using GSSAPI over FTP. + +See RFC2228 for details. +""" + +from ftplib import * + +import base64, ftplib, getpass, kerberos, socket, sys + + +class SecureFtp(FTP): + """Extended version of ftplib.FTP that can authenticate using GSSAPI.""" + def mic_putcmd(self, line): + rc = kerberos.authGSSClientWrap(self.vc, base64.b64encode(line)) + wrapped = kerberos.authGSSClientResponse(self.vc) + FTP.putcmd(self, "MIC " + wrapped) + + def mic_getline(self): + resp = FTP.getline(self) + assert resp[:4] == '631 ' + rc = kerberos.authGSSClientUnwrap(self.vc, resp[4:].strip("\r\n")) + response = base64.b64decode(kerberos.authGSSClientResponse(self.vc)) + return response + + def gssapi_login(self, user): + # Try GSSAPI login first + resp = self.sendcmd('AUTH GSSAPI') + if resp[:3] == '334': + rc, self.vc = kerberos.authGSSClientInit("ftp@%s" % self.host) + + if kerberos.authGSSClientStep(self.vc, "") != 1: + while resp[:3] in ('334', '335'): + authdata = kerberos.authGSSClientResponse(self.vc) + resp = self.sendcmd('ADAT ' + authdata) + if resp[:9] in ('235 ADAT=', '335 ADAT='): + rc = kerberos.authGSSClientStep(self.vc, resp[9:]) + assert ((resp[:3] == '235' and rc == 1) or + (resp[:3] == '335' and rc == 0)) + print "Authenticated as %s" % kerberos.authGSSClientUserName(self.vc) + + # Monkey patch ftplib + self.putcmd = self.mic_putcmd + self.getline = self.mic_getline + + self.sendcmd('USER ' + user) + return resp + + +def test(): + '''Test program. + Usage: ftp [-d] [-u[user]] [-r[file]] host [-l[dir]] [-d[dir]] [-p] [file] ... + + -d dir + -l list + -u user + ''' + from getopt import getopt + + if len(sys.argv) < 2: + print test.__doc__ + sys.exit(0) + + (opts, args) = getopt(sys.argv[1:], "d:u:r:") + + debugging = 0 + rcfile = None + userid = None + + for (k, v) in opts: + if k == "-d": + debugging += 1 + elif k == "-u": + userid = v + elif k == "-r": + rcfile = v + + host = args[0] + ftp = SecureFtp(host) + ftp.set_debuglevel(debugging) + passwd = acct = '' + try: + netrc = Netrc(rcfile) + except IOError: + if rcfile is not None and userid is None: + sys.stderr.write("Could not open account file" + " -- using anonymous login.") + userid = '' + else: + if userid is None: + try: + userid, passwd, acct = netrc.get_account(host) + except KeyError: + # no account for host + sys.stderr.write( + "No account -- using anonymous login.") + userid = '' + try: + if userid: + ftp.gssapi_login(userid) + else: + ftp.login(userid, passwd, acct) + except ftplib.error_perm, e: + # Fall back to regular authentication + ftp.login(userid, passwd, acct) + for file in args[1:]: + if file[:2] == '-l': + ftp.dir(file[2:]) + elif file[:2] == '-d': + cmd = 'CWD' + if file[2:]: cmd = cmd + ' ' + file[2:] + resp = ftp.sendcmd(cmd) + elif file == '-p': + ftp.set_pasv(not ftp.passiveserver) + else: + ftp.retrbinary('RETR ' + file, \ + sys.stdout.write, 1024) + ftp.quit() + + +if __name__ == '__main__': + test() diff --git a/bin/ftp-gss b/bin/ftp-gss new file mode 100755 index 0000000..62a6249 --- /dev/null +++ b/bin/ftp-gss @@ -0,0 +1,137 @@ +#!/usr/bin/env python +## +# Copyright (c) 2008 Jelmer Vernooij <[email protected]> +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Support for secure authentication using GSSAPI over FTP. + +See RFC2228 for details. +""" + +from ftplib import * + +import base64, ftplib, getpass, kerberos, socket, sys + + +class SecureFtp(FTP): + """Extended version of ftplib.FTP that can authenticate using GSSAPI.""" + def mic_putcmd(self, line): + rc = kerberos.authGSSClientWrap(self.vc, base64.b64encode(line)) + wrapped = kerberos.authGSSClientResponse(self.vc) + FTP.putcmd(self, "MIC " + wrapped) + + def mic_getline(self): + resp = FTP.getline(self) + assert resp[:4] == '631 ' + rc = kerberos.authGSSClientUnwrap(self.vc, resp[4:].strip("\r\n")) + response = base64.b64decode(kerberos.authGSSClientResponse(self.vc)) + return response + + def gssapi_login(self, user): + # Try GSSAPI login first + resp = self.sendcmd('AUTH GSSAPI') + if resp[:3] == '334': + rc, self.vc = kerberos.authGSSClientInit("ftp@%s" % self.host) + + if kerberos.authGSSClientStep(self.vc, "") != 1: + while resp[:3] in ('334', '335'): + authdata = kerberos.authGSSClientResponse(self.vc) + resp = self.sendcmd('ADAT ' + authdata) + if resp[:9] in ('235 ADAT=', '335 ADAT='): + rc = kerberos.authGSSClientStep(self.vc, resp[9:]) + assert ((resp[:3] == '235' and rc == 1) or + (resp[:3] == '335' and rc == 0)) + print "Authenticated as %s" % kerberos.authGSSClientUserName(self.vc) + + # Monkey patch ftplib + self.putcmd = self.mic_putcmd + self.getline = self.mic_getline + + self.sendcmd('USER ' + user) + return resp + + +def test(): + '''Test program. + Usage: ftp [-d] [-u[user]] [-r[file]] host [-l[dir]] [-d[dir]] [-p] [file] ... + + -d dir + -l list + -u user + ''' + from getopt import getopt + + if len(sys.argv) < 2: + print test.__doc__ + sys.exit(0) + + (opts, args) = getopt(sys.argv[1:], "d:u:r:") + + debugging = 0 + rcfile = None + userid = None + + for (k, v) in opts: + if k == "-d": + debugging += 1 + elif k == "-u": + userid = v + elif k == "-r": + rcfile = v + + host = args[0] + ftp = SecureFtp(host) + ftp.set_debuglevel(debugging) + passwd = acct = '' + try: + netrc = Netrc(rcfile) + except IOError: + if rcfile is not None and userid is None: + sys.stderr.write("Could not open account file" + " -- using anonymous login.") + userid = '' + else: + if userid is None: + try: + userid, passwd, acct = netrc.get_account(host) + except KeyError: + # no account for host + sys.stderr.write( + "No account -- using anonymous login.") + userid = '' + try: + if userid: + ftp.gssapi_login(userid) + else: + ftp.login(userid, passwd, acct) + except ftplib.error_perm, e: + # Fall back to regular authentication + ftp.login(userid, passwd, acct) + for file in args[1:]: + if file[:2] == '-l': + ftp.dir(file[2:]) + elif file[:2] == '-d': + cmd = 'CWD' + if file[2:]: cmd = cmd + ' ' + file[2:] + resp = ftp.sendcmd(cmd) + elif file == '-p': + ftp.set_pasv(not ftp.passiveserver) + else: + ftp.retrbinary('RETR ' + file, \ + sys.stdout.write, 1024) + ftp.quit() + + +if __name__ == '__main__': + test() diff --git a/config/.svn/all-wcprops b/config/.svn/all-wcprops new file mode 100644 index 0000000..6337021 --- /dev/null +++ b/config/.svn/all-wcprops @@ -0,0 +1,11 @@ +K 25 +svn:wc:ra_dav:version-url +V 64 +/repository/calendarserver/!svn/ver/2942/PyKerberos/trunk/config +END +edu.mit.Kerberos +K 25 +svn:wc:ra_dav:version-url +V 81 +/repository/calendarserver/!svn/ver/2942/PyKerberos/trunk/config/edu.mit.Kerberos +END diff --git a/config/.svn/entries b/config/.svn/entries new file mode 100644 index 0000000..8e3c139 --- /dev/null +++ b/config/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +10603 +http://svn.calendarserver.org/repository/calendarserver/PyKerberos/trunk/config +http://svn.calendarserver.org/repository/calendarserver + + + +2008-09-06T16:54:18.450850Z +2942 [email protected] + + + + + + + + + + + + + + +e27351fd-9f3e-4f54-a53b-843176b1656c + +edu.mit.Kerberos +file + + + + +2013-01-30T21:54:22.000000Z +f7512b6a5325eb8be029cbb98a9725b2 +2008-09-06T16:54:18.450850Z +2942 [email protected] + + + + + + + + + + + + + + + + + + + + + +271 + diff --git a/config/.svn/text-base/edu.mit.Kerberos.svn-base b/config/.svn/text-base/edu.mit.Kerberos.svn-base new file mode 100644 index 0000000..6004e37 --- /dev/null +++ b/config/.svn/text-base/edu.mit.Kerberos.svn-base @@ -0,0 +1,14 @@ +[libdefaults] + default_realm = EXAMPLE.COM + dns_fallback = NO + default_tkt_enctypes = des-cbc-crc + default_tgs_enctypes = des-cbc-crc + +[realms] + EXAMPLE.COM = { + kdc = kdc.example.com + } + +[domain_realm] + .example.com = EXAMPLE.COM + example.com = EXAMPLE.COM diff --git a/config/edu.mit.Kerberos b/config/edu.mit.Kerberos new file mode 100644 index 0000000..6004e37 --- /dev/null +++ b/config/edu.mit.Kerberos @@ -0,0 +1,14 @@ +[libdefaults] + default_realm = EXAMPLE.COM + dns_fallback = NO + default_tkt_enctypes = des-cbc-crc + default_tgs_enctypes = des-cbc-crc + +[realms] + EXAMPLE.COM = { + kdc = kdc.example.com + } + +[domain_realm] + .example.com = EXAMPLE.COM + example.com = EXAMPLE.COM diff --git a/pysrc/.svn/all-wcprops b/pysrc/.svn/all-wcprops new file mode 100644 index 0000000..135ece6 --- /dev/null +++ b/pysrc/.svn/all-wcprops @@ -0,0 +1,11 @@ +K 25 +svn:wc:ra_dav:version-url +V 64 +/repository/calendarserver/!svn/ver/10302/PyKerberos/trunk/pysrc +END +kerberos.py +K 25 +svn:wc:ra_dav:version-url +V 76 +/repository/calendarserver/!svn/ver/10302/PyKerberos/trunk/pysrc/kerberos.py +END diff --git a/pysrc/.svn/entries b/pysrc/.svn/entries new file mode 100644 index 0000000..8b807c8 --- /dev/null +++ b/pysrc/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +10603 +http://svn.calendarserver.org/repository/calendarserver/PyKerberos/trunk/pysrc +http://svn.calendarserver.org/repository/calendarserver + + + +2013-01-15T00:00:30.229472Z +10302 [email protected] + + + + + + + + + + + + + + +e27351fd-9f3e-4f54-a53b-843176b1656c + +kerberos.py +file + + + + +2013-01-30T21:54:22.000000Z +6fbaf5a0fdf26f1b196ddf60f50d2d8a +2013-01-15T00:00:30.229472Z +10302 [email protected] + + + + + + + + + + + + + + + + + + + + + +9058 + diff --git a/pysrc/.svn/text-base/kerberos.py.svn-base b/pysrc/.svn/text-base/kerberos.py.svn-base new file mode 100644 index 0000000..1fed7e8 --- /dev/null +++ b/pysrc/.svn/text-base/kerberos.py.svn-base @@ -0,0 +1,227 @@ +## +# Copyright (c) 2006-2013 Apple Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +## + +""" +PyKerberos Function Description. +""" + +class KrbError(Exception): + pass + +class BasicAuthError(KrbError): + pass + +class GSSError(KrbError): + pass + +def checkPassword(user, pswd, service, default_realm): + """ + This function provides a simple way to verify that a user name and password match + those normally used for Kerberos authentication. It does this by checking that the + supplied user name and password can be used to get a ticket for the supplied service. + If the user name does not contain a realm, then the default realm supplied is used. + + NB For this to work properly the Kerberos must be configured properly on this machine. + That will likely mean ensuring that the edu.mit.Kerberos preference file has the correct + realms and KDCs listed. + + @param user: a string containing the Kerberos user name. A realm may be + included by appending an '@' followed by the realm string to the actual user id. + If no realm is supplied, then the realm set in the default_realm argument will + be used. + @param pswd: a string containing the password for the user. + @param service: a string containging the Kerberos service to check access for. + This will be of the form 'sss/xx.yy.zz', where 'sss' is the service identifier + (e.g., 'http', 'krbtgt'), and 'xx.yy.zz' is the hostname of the server. + @param default_realm: a string containing the default realm to use if one is not + supplied in the user argument. Note that Kerberos realms are normally all + uppercase (e.g., 'EXAMPLE.COM'). + @return: True if authentication succeeds, False otherwise. + """ + +def changePassword(user, oldpswd, newpswd): + """ + This function allows to change the user password on the KDC. + + @param user: a string containing the Kerberos user name. A realm may be + included by appending an '@' followed by the realm string to the actual user id. + If no realm is supplied, then the realm set in the default_realm argument will + be used. + @param oldpswd: a string containing the old (current) password for the user. + @param newpswd: a string containging the new password for the user. + @return: True if password changing succeeds, False otherwise. + """ + +def getServerPrincipalDetails(service, hostname): + """ + This function returns the service principal for the server given a service type + and hostname. Details are looked up via the /etc/keytab file. + + @param service: a string containing the Kerberos service type for the server. + @param hostname: a string containing the hostname of the server. + @return: a string containing the service principal. + """ + +""" +GSSAPI Function Result Codes: + + -1 : Error + 0 : GSSAPI step continuation (only returned by 'Step' function) + 1 : GSSAPI step complete, or function return OK + +""" + +# Some useful result codes +AUTH_GSS_CONTINUE = 0 +AUTH_GSS_COMPLETE = 1 + +# Some useful gss flags +GSS_C_DELEG_FLAG = 1 +GSS_C_MUTUAL_FLAG = 2 +GSS_C_REPLAY_FLAG = 4 +GSS_C_SEQUENCE_FLAG = 8 +GSS_C_CONF_FLAG = 16 +GSS_C_INTEG_FLAG = 32 +GSS_C_ANON_FLAG = 64 +GSS_C_PROT_READY_FLAG = 128 +GSS_C_TRANS_FLAG = 256 + +def authGSSClientInit(service, principal=None, gssflags=GSS_C_MUTUAL_FLAG|GSS_C_SEQUENCE_FLAG): + """ + Initializes a context for GSSAPI client-side authentication with the given service principal. + authGSSClientClean must be called after this function returns an OK result to dispose of + the context once all GSSAPI operations are complete. + + @param service: a string containing the service principal in the form 'type@fqdn' + (e.g. '[email protected]'). + @param principal: optional string containing the client principal in the form 'user@realm' + (e.g. '[email protected]'). + @param gssflags: optional integer used to set GSS flags. + (e.g. GSS_C_DELEG_FLAG|GSS_C_MUTUAL_FLAG|GSS_C_SEQUENCE_FLAG will allow + for forwarding credentials to the remote host) + @return: a tuple of (result, context) where result is the result code (see above) and + context is an opaque value that will need to be passed to subsequent functions. + """ + +def authGSSClientClean(context): + """ + Destroys the context for GSSAPI client-side authentication. After this call the context + object is invalid and should not be used again. + + @param context: the context object returned from authGSSClientInit. + @return: a result code (see above). + """ + +def authGSSClientStep(context, challenge): + """ + Processes a single GSSAPI client-side step using the supplied server data. + + @param context: the context object returned from authGSSClientInit. + @param challenge: a string containing the base64-encoded server data (which may be empty + for the first step). + @return: a result code (see above). + """ + +def authGSSClientResponse(context): + """ + Get the client response from the last successful GSSAPI client-side step. + + @param context: the context object returned from authGSSClientInit. + @return: a string containing the base64-encoded client data to be sent to the server. + """ + +def authGSSClientUserName(context): + """ + Get the user name of the principal authenticated via the now complete GSSAPI client-side operations. + This method must only be called after authGSSClientStep returns a complete response code. + + @param context: the context object returned from authGSSClientInit. + @return: a string containing the user name. + """ + +def authGSSClientUnwrap(context, challenge): + """ + Perform the client side GSSAPI unwrap step + + @param challenge: a string containing the base64-encoded server data. + @return: a result code (see above) + """ + +def authGSSClientWrap(context, data, user=None): + """ + Perform the client side GSSAPI wrap step. + + @param data:the result of the authGSSClientResponse after the authGSSClientUnwrap + @param user: the user to authorize + @return: a result code (see above) + """ + +def authGSSServerInit(service): + """ + Initializes a context for GSSAPI server-side authentication with the given service principal. + authGSSServerClean must be called after this function returns an OK result to dispose of + the context once all GSSAPI operations are complete. + + @param service: a string containing the service principal in the form 'type@fqdn' + (e.g. '[email protected]'). + @return: a tuple of (result, context) where result is the result code (see above) and + context is an opaque value that will need to be passed to subsequent functions. + """ + +def authGSSServerClean(context): + """ + Destroys the context for GSSAPI server-side authentication. After this call the context + object is invalid and should not be used again. + + @param context: the context object returned from authGSSServerInit. + @return: a result code (see above). + """ + +def authGSSServerStep(context, challenge): + """ + Processes a single GSSAPI server-side step using the supplied client data. + + @param context: the context object returned from authGSSServerInit. + @param challenge: a string containing the base64-encoded client data. + @return: a result code (see above). + """ + +def authGSSServerResponse(context): + """ + Get the server response from the last successful GSSAPI server-side step. + + @param context: the context object returned from authGSSServerInit. + @return: a string containing the base64-encoded server data to be sent to the client. + """ + +def authGSSServerUserName(context): + """ + Get the user name of the principal trying to authenticate to the server. + This method must only be called after authGSSServerStep returns a complete or continue response code. + + @param context: the context object returned from authGSSServerInit. + @return: a string containing the user name. + """ + +def authGSSServerTargetName(context): + """ + Get the target name if the server did not supply its own credentials. + This method must only be called after authGSSServerStep returns a complete or continue response code. + + @param context: the context object returned from authGSSServerInit. + @return: a string containing the target name. + """ + diff --git a/pysrc/kerberos.py b/pysrc/kerberos.py new file mode 100644 index 0000000..1fed7e8 --- /dev/null +++ b/pysrc/kerberos.py @@ -0,0 +1,227 @@ +## +# Copyright (c) 2006-2013 Apple Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +## + +""" +PyKerberos Function Description. +""" + +class KrbError(Exception): + pass + +class BasicAuthError(KrbError): + pass + +class GSSError(KrbError): + pass + +def checkPassword(user, pswd, service, default_realm): + """ + This function provides a simple way to verify that a user name and password match + those normally used for Kerberos authentication. It does this by checking that the + supplied user name and password can be used to get a ticket for the supplied service. + If the user name does not contain a realm, then the default realm supplied is used. + + NB For this to work properly the Kerberos must be configured properly on this machine. + That will likely mean ensuring that the edu.mit.Kerberos preference file has the correct + realms and KDCs listed. + + @param user: a string containing the Kerberos user name. A realm may be + included by appending an '@' followed by the realm string to the actual user id. + If no realm is supplied, then the realm set in the default_realm argument will + be used. + @param pswd: a string containing the password for the user. + @param service: a string containging the Kerberos service to check access for. + This will be of the form 'sss/xx.yy.zz', where 'sss' is the service identifier + (e.g., 'http', 'krbtgt'), and 'xx.yy.zz' is the hostname of the server. + @param default_realm: a string containing the default realm to use if one is not + supplied in the user argument. Note that Kerberos realms are normally all + uppercase (e.g., 'EXAMPLE.COM'). + @return: True if authentication succeeds, False otherwise. + """ + +def changePassword(user, oldpswd, newpswd): + """ + This function allows to change the user password on the KDC. + + @param user: a string containing the Kerberos user name. A realm may be + included by appending an '@' followed by the realm string to the actual user id. + If no realm is supplied, then the realm set in the default_realm argument will + be used. + @param oldpswd: a string containing the old (current) password for the user. + @param newpswd: a string containging the new password for the user. + @return: True if password changing succeeds, False otherwise. + """ + +def getServerPrincipalDetails(service, hostname): + """ + This function returns the service principal for the server given a service type + and hostname. Details are looked up via the /etc/keytab file. + + @param service: a string containing the Kerberos service type for the server. + @param hostname: a string containing the hostname of the server. + @return: a string containing the service principal. + """ + +""" +GSSAPI Function Result Codes: + + -1 : Error + 0 : GSSAPI step continuation (only returned by 'Step' function) + 1 : GSSAPI step complete, or function return OK + +""" + +# Some useful result codes +AUTH_GSS_CONTINUE = 0 +AUTH_GSS_COMPLETE = 1 + +# Some useful gss flags +GSS_C_DELEG_FLAG = 1 +GSS_C_MUTUAL_FLAG = 2 +GSS_C_REPLAY_FLAG = 4 +GSS_C_SEQUENCE_FLAG = 8 +GSS_C_CONF_FLAG = 16 +GSS_C_INTEG_FLAG = 32 +GSS_C_ANON_FLAG = 64 +GSS_C_PROT_READY_FLAG = 128 +GSS_C_TRANS_FLAG = 256 + +def authGSSClientInit(service, principal=None, gssflags=GSS_C_MUTUAL_FLAG|GSS_C_SEQUENCE_FLAG): + """ + Initializes a context for GSSAPI client-side authentication with the given service principal. + authGSSClientClean must be called after this function returns an OK result to dispose of + the context once all GSSAPI operations are complete. + + @param service: a string containing the service principal in the form 'type@fqdn' + (e.g. '[email protected]'). + @param principal: optional string containing the client principal in the form 'user@realm' + (e.g. '[email protected]'). + @param gssflags: optional integer used to set GSS flags. + (e.g. GSS_C_DELEG_FLAG|GSS_C_MUTUAL_FLAG|GSS_C_SEQUENCE_FLAG will allow + for forwarding credentials to the remote host) + @return: a tuple of (result, context) where result is the result code (see above) and + context is an opaque value that will need to be passed to subsequent functions. + """ + +def authGSSClientClean(context): + """ + Destroys the context for GSSAPI client-side authentication. After this call the context + object is invalid and should not be used again. + + @param context: the context object returned from authGSSClientInit. + @return: a result code (see above). + """ + +def authGSSClientStep(context, challenge): + """ + Processes a single GSSAPI client-side step using the supplied server data. + + @param context: the context object returned from authGSSClientInit. + @param challenge: a string containing the base64-encoded server data (which may be empty + for the first step). + @return: a result code (see above). + """ + +def authGSSClientResponse(context): + """ + Get the client response from the last successful GSSAPI client-side step. + + @param context: the context object returned from authGSSClientInit. + @return: a string containing the base64-encoded client data to be sent to the server. + """ + +def authGSSClientUserName(context): + """ + Get the user name of the principal authenticated via the now complete GSSAPI client-side operations. + This method must only be called after authGSSClientStep returns a complete response code. + + @param context: the context object returned from authGSSClientInit. + @return: a string containing the user name. + """ + +def authGSSClientUnwrap(context, challenge): + """ + Perform the client side GSSAPI unwrap step + + @param challenge: a string containing the base64-encoded server data. + @return: a result code (see above) + """ + +def authGSSClientWrap(context, data, user=None): + """ + Perform the client side GSSAPI wrap step. + + @param data:the result of the authGSSClientResponse after the authGSSClientUnwrap + @param user: the user to authorize + @return: a result code (see above) + """ + +def authGSSServerInit(service): + """ + Initializes a context for GSSAPI server-side authentication with the given service principal. + authGSSServerClean must be called after this function returns an OK result to dispose of + the context once all GSSAPI operations are complete. + + @param service: a string containing the service principal in the form 'type@fqdn' + (e.g. '[email protected]'). + @return: a tuple of (result, context) where result is the result code (see above) and + context is an opaque value that will need to be passed to subsequent functions. + """ + +def authGSSServerClean(context): + """ + Destroys the context for GSSAPI server-side authentication. After this call the context + object is invalid and should not be used again. + + @param context: the context object returned from authGSSServerInit. + @return: a result code (see above). + """ + +def authGSSServerStep(context, challenge): + """ + Processes a single GSSAPI server-side step using the supplied client data. + + @param context: the context object returned from authGSSServerInit. + @param challenge: a string containing the base64-encoded client data. + @return: a result code (see above). + """ + +def authGSSServerResponse(context): + """ + Get the server response from the last successful GSSAPI server-side step. + + @param context: the context object returned from authGSSServerInit. + @return: a string containing the base64-encoded server data to be sent to the client. + """ + +def authGSSServerUserName(context): + """ + Get the user name of the principal trying to authenticate to the server. + This method must only be called after authGSSServerStep returns a complete or continue response code. + + @param context: the context object returned from authGSSServerInit. + @return: a string containing the user name. + """ + +def authGSSServerTargetName(context): + """ + Get the target name if the server did not supply its own credentials. + This method must only be called after authGSSServerStep returns a complete or continue response code. + + @param context: the context object returned from authGSSServerInit. + @return: a string containing the target name. + """ + diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..166bda4 --- /dev/null +++ b/setup.py @@ -0,0 +1,54 @@ +## +# Copyright (c) 2006-2013 Apple Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +## + +from distutils.core import setup, Extension +import sys +import commands + +long_description = """ +This Python package is a high-level wrapper for Kerberos (GSSAPI) operations. +The goal is to avoid having to build a module that wraps the entire Kerberos.framework, +and instead offer a limited set of functions that do what is needed for client/server +Kerberos authentication based on <http://www.ietf.org/rfc/rfc4559.txt>. + +""" + +setup ( + name = "kerberos", + version = "1.1.1", + description = "Kerberos high-level interface", + long_description=long_description, + classifiers = [ + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python :: 2", + "Topic :: Software Development :: Libraries :: Python Modules", + "Topic :: System :: Systems Administration :: Authentication/Directory" + ], + ext_modules = [ + Extension( + "kerberos", + extra_link_args = commands.getoutput("krb5-config --libs gssapi").split(), + extra_compile_args = commands.getoutput("krb5-config --cflags gssapi").split(), + sources = [ + "src/kerberos.c", + "src/kerberosbasic.c", + "src/kerberosgss.c", + "src/kerberospw.c", + "src/base64.c" + ], + ), + ], +) diff --git a/src/.svn/all-wcprops b/src/.svn/all-wcprops new file mode 100644 index 0000000..b20ceae --- /dev/null +++ b/src/.svn/all-wcprops @@ -0,0 +1,59 @@ +K 25 +svn:wc:ra_dav:version-url +V 62 +/repository/calendarserver/!svn/ver/10302/PyKerberos/trunk/src +END +kerberosbasic.c +K 25 +svn:wc:ra_dav:version-url +V 78 +/repository/calendarserver/!svn/ver/10302/PyKerberos/trunk/src/kerberosbasic.c +END +kerberosgss.h +K 25 +svn:wc:ra_dav:version-url +V 76 +/repository/calendarserver/!svn/ver/10302/PyKerberos/trunk/src/kerberosgss.h +END +kerberosbasic.h +K 25 +svn:wc:ra_dav:version-url +V 78 +/repository/calendarserver/!svn/ver/10302/PyKerberos/trunk/src/kerberosbasic.h +END +kerberospw.c +K 25 +svn:wc:ra_dav:version-url +V 74 +/repository/calendarserver/!svn/ver/2447/PyKerberos/trunk/src/kerberospw.c +END +base64.c +K 25 +svn:wc:ra_dav:version-url +V 71 +/repository/calendarserver/!svn/ver/10302/PyKerberos/trunk/src/base64.c +END +kerberospw.h +K 25 +svn:wc:ra_dav:version-url +V 74 +/repository/calendarserver/!svn/ver/2325/PyKerberos/trunk/src/kerberospw.h +END +base64.h +K 25 +svn:wc:ra_dav:version-url +V 71 +/repository/calendarserver/!svn/ver/10302/PyKerberos/trunk/src/base64.h +END +kerberosgss.c +K 25 +svn:wc:ra_dav:version-url +V 76 +/repository/calendarserver/!svn/ver/10302/PyKerberos/trunk/src/kerberosgss.c +END +kerberos.c +K 25 +svn:wc:ra_dav:version-url +V 73 +/repository/calendarserver/!svn/ver/10302/PyKerberos/trunk/src/kerberos.c +END diff --git a/src/.svn/entries b/src/.svn/entries new file mode 100644 index 0000000..261f2be --- /dev/null +++ b/src/.svn/entries @@ -0,0 +1,334 @@ +10 + +dir +10603 +http://svn.calendarserver.org/repository/calendarserver/PyKerberos/trunk/src +http://svn.calendarserver.org/repository/calendarserver + + + +2013-01-15T00:00:30.229472Z +10302 [email protected] + + + + + + + + + + + + + + +e27351fd-9f3e-4f54-a53b-843176b1656c + +kerberosbasic.c +file + + + + +2013-01-30T21:54:22.000000Z +622007a464cc44c37c49b3bc0e6f6666 +2013-01-15T00:00:30.229472Z +10302 [email protected] + + + + + + + + + + + + + + + + + + + + + +3963 + +kerberosgss.h +file + + + + +2013-01-30T21:54:22.000000Z +7840b0a599a28ebf727073a90f5f6819 +2013-01-15T00:00:30.229472Z +10302 [email protected] + + + + + + + + + + + + + + + + + + + + + +2260 + +kerberosbasic.h +file + + + + +2013-01-30T21:54:22.000000Z +c2316e5230765726033a678d5d12dbce +2013-01-15T00:00:30.229472Z +10302 [email protected] + + + + + + + + + + + + + + + + + + + + + +898 + +kerberospw.c +file + + + + +2013-01-30T21:54:22.000000Z +c6fc4a620a89befe7109a5f1367951fa +2008-05-23T02:16:22.876072Z +2447 [email protected] + + + + + + + + + + + + + + + + + + + + + +4414 + +base64.c +file + + + + +2013-01-30T21:54:22.000000Z +57c6113999a720fca785c276f7773d56 +2013-01-15T00:00:30.229472Z +10302 [email protected] + + + + + + + + + + + + + + + + + + + + + +3685 + +kerberospw.h +file + + + + +2013-01-30T21:54:22.000000Z +44f013d2b3872bb72206efe7fb4e453c +2008-04-16T20:15:24.869778Z +2325 [email protected] + + + + + + + + + + + + + + + + + + + + + +867 + +base64.h +file + + + + +2013-01-30T21:54:22.000000Z +d5f1513c554a48315e4bbf5c04492e7d +2013-01-15T00:00:30.229472Z +10302 [email protected] + + + + + + + + + + + + + + + + + + + + + +772 + +kerberosgss.c +file + + + + +2013-01-30T21:54:22.000000Z +ee25675f6d60a9c9fb8403afc231ca85 +2013-01-15T00:00:30.229472Z +10302 [email protected] + + + + + + + + + + + + + + + + + + + + + +20327 + +kerberos.c +file + + + + +2013-01-30T21:54:22.000000Z +7c39ab66d2b7cd8c869e56c029443834 +2013-01-15T00:00:30.229472Z +10302 [email protected] + + + + + + + + + + + + + + + + + + + + + +13940 + diff --git a/src/.svn/text-base/base64.c.svn-base b/src/.svn/text-base/base64.c.svn-base new file mode 100644 index 0000000..877379f --- /dev/null +++ b/src/.svn/text-base/base64.c.svn-base @@ -0,0 +1,120 @@ +/** + * Copyright (c) 2006-2013 Apple Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +#include "base64.h" + +#include <stdlib.h> +#include <string.h> + +// base64 tables +static char basis_64[] = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; +static signed char index_64[128] = +{ + -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, + -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, + -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,62, -1,-1,-1,63, + 52,53,54,55, 56,57,58,59, 60,61,-1,-1, -1,-1,-1,-1, + -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11,12,13,14, + 15,16,17,18, 19,20,21,22, 23,24,25,-1, -1,-1,-1,-1, + -1,26,27,28, 29,30,31,32, 33,34,35,36, 37,38,39,40, + 41,42,43,44, 45,46,47,48, 49,50,51,-1, -1,-1,-1,-1 +}; +#define CHAR64(c) (((c) < 0 || (c) > 127) ? -1 : index_64[(c)]) + +// base64_encode : base64 encode +// +// value : data to encode +// vlen : length of data +// (result) : new char[] - c-str of result +char *base64_encode(const unsigned char *value, size_t vlen) +{ + char *result = (char *)malloc((vlen * 4) / 3 + 5); + char *out = result; + while (vlen >= 3) + { + *out++ = basis_64[value[0] >> 2]; + *out++ = basis_64[((value[0] << 4) & 0x30) | (value[1] >> 4)]; + *out++ = basis_64[((value[1] << 2) & 0x3C) | (value[2] >> 6)]; + *out++ = basis_64[value[2] & 0x3F]; + value += 3; + vlen -= 3; + } + if (vlen > 0) + { + *out++ = basis_64[value[0] >> 2]; + unsigned char oval = (value[0] << 4) & 0x30; + if (vlen > 1) oval |= value[1] >> 4; + *out++ = basis_64[oval]; + *out++ = (vlen < 2) ? '=' : basis_64[(value[1] << 2) & 0x3C]; + *out++ = '='; + } + *out = '\0'; + + return result; +} + +// base64_decode : base64 decode +// +// value : c-str to decode +// rlen : length of decoded result +// (result) : new unsigned char[] - decoded result +unsigned char *base64_decode(const char *value, size_t *rlen) +{ + *rlen = 0; + int c1, c2, c3, c4; + + size_t vlen = strlen(value); + unsigned char *result =(unsigned char *)malloc((vlen * 3) / 4 + 1); + unsigned char *out = result; + + while (1) + { + if (value[0]==0) + return result; + c1 = value[0]; + if (CHAR64(c1) == -1) + goto base64_decode_error;; + c2 = value[1]; + if (CHAR64(c2) == -1) + goto base64_decode_error;; + c3 = value[2]; + if ((c3 != '=') && (CHAR64(c3) == -1)) + goto base64_decode_error;; + c4 = value[3]; + if ((c4 != '=') && (CHAR64(c4) == -1)) + goto base64_decode_error;; + + value += 4; + *out++ = (CHAR64(c1) << 2) | (CHAR64(c2) >> 4); + *rlen += 1; + if (c3 != '=') + { + *out++ = ((CHAR64(c2) << 4) & 0xf0) | (CHAR64(c3) >> 2); + *rlen += 1; + if (c4 != '=') + { + *out++ = ((CHAR64(c3) << 6) & 0xc0) | CHAR64(c4); + *rlen += 1; + } + } + } + +base64_decode_error: + *result = 0; + *rlen = 0; + return result; +} diff --git a/src/.svn/text-base/base64.h.svn-base b/src/.svn/text-base/base64.h.svn-base new file mode 100644 index 0000000..9ea9c6b --- /dev/null +++ b/src/.svn/text-base/base64.h.svn-base @@ -0,0 +1,19 @@ +/** + * Copyright (c) 2006-2013 Apple Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +#include <stddef.h> +char *base64_encode(const unsigned char *value, size_t vlen); +unsigned char *base64_decode(const char *value, size_t *rlen); diff --git a/src/.svn/text-base/kerberos.c.svn-base b/src/.svn/text-base/kerberos.c.svn-base new file mode 100644 index 0000000..d65c7ff --- /dev/null +++ b/src/.svn/text-base/kerberos.c.svn-base @@ -0,0 +1,468 @@ +/** + * Copyright (c) 2006-2013 Apple Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +#include <Python.h> + +#include "kerberosbasic.h" +#include "kerberospw.h" +#include "kerberosgss.h" + +PyObject *KrbException_class; +PyObject *BasicAuthException_class; +PyObject *PwdChangeException_class; +PyObject *GssException_class; + +static PyObject *checkPassword(PyObject *self, PyObject *args) +{ + 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)) + return NULL; + + result = authenticate_user_krb5pwd(user, pswd, service, default_realm); + + if (result) + return Py_INCREF(Py_True), Py_True; + else + return NULL; +} + +static PyObject *changePassword(PyObject *self, PyObject *args) +{ + const char *newpswd = NULL; + const char *oldpswd = NULL; + const char *user = NULL; + int result = 0; + + if (!PyArg_ParseTuple(args, "sss", &user, &oldpswd, &newpswd)) + return NULL; + + result = change_user_krb5pwd(user, oldpswd, newpswd); + + if (result) + return Py_INCREF(Py_True), Py_True; + else + return NULL; +} + +static PyObject *getServerPrincipalDetails(PyObject *self, PyObject *args) +{ + const char *service = NULL; + const char *hostname = NULL; + char* result; + + if (!PyArg_ParseTuple(args, "ss", &service, &hostname)) + return NULL; + + result = server_principal_details(service, hostname); + + if (result != NULL) + { + PyObject* pyresult = Py_BuildValue("s", result); + free(result); + return pyresult; + } + else + return NULL; +} + +static PyObject* authGSSClientInit(PyObject* self, PyObject* args, PyObject* keywds) +{ + const char *service = NULL; + const char *principal = NULL; + gss_client_state *state; + PyObject *pystate; + static char *kwlist[] = {"service", "principal", "gssflags", NULL}; + long int gss_flags = GSS_C_MUTUAL_FLAG | GSS_C_SEQUENCE_FLAG; + int result = 0; + + if (!PyArg_ParseTupleAndKeywords(args, keywds, "s|zl", kwlist, &service, &principal, &gss_flags)) + return NULL; + + state = (gss_client_state *) malloc(sizeof(gss_client_state)); + pystate = PyCObject_FromVoidPtr(state, NULL); + + result = authenticate_gss_client_init(service, principal, gss_flags, state); + if (result == AUTH_GSS_ERROR) + return NULL; + + return Py_BuildValue("(iO)", result, pystate); +} + +static PyObject *authGSSClientClean(PyObject *self, PyObject *args) +{ + gss_client_state *state; + PyObject *pystate; + int result = 0; + + if (!PyArg_ParseTuple(args, "O", &pystate)) + return NULL; + + if (!PyCObject_Check(pystate)) { + PyErr_SetString(PyExc_TypeError, "Expected a context object"); + return NULL; + } + + state = (gss_client_state *)PyCObject_AsVoidPtr(pystate); + if (state != NULL) + { + result = authenticate_gss_client_clean(state); + + free(state); + PyCObject_SetVoidPtr(pystate, NULL); + } + + return Py_BuildValue("i", result); +} + +static PyObject *authGSSClientStep(PyObject *self, PyObject *args) +{ + gss_client_state *state; + PyObject *pystate; + char *challenge = NULL; + int result = 0; + + if (!PyArg_ParseTuple(args, "Os", &pystate, &challenge)) + return NULL; + + if (!PyCObject_Check(pystate)) { + PyErr_SetString(PyExc_TypeError, "Expected a context object"); + return NULL; + } + + state = (gss_client_state *)PyCObject_AsVoidPtr(pystate); + if (state == NULL) + return NULL; + + result = authenticate_gss_client_step(state, challenge); + if (result == AUTH_GSS_ERROR) + return NULL; + + return Py_BuildValue("i", result); +} + +static PyObject *authGSSClientResponse(PyObject *self, PyObject *args) +{ + gss_client_state *state; + PyObject *pystate; + + if (!PyArg_ParseTuple(args, "O", &pystate)) + return NULL; + + if (!PyCObject_Check(pystate)) { + PyErr_SetString(PyExc_TypeError, "Expected a context object"); + return NULL; + } + + state = (gss_client_state *)PyCObject_AsVoidPtr(pystate); + if (state == NULL) + return NULL; + + return Py_BuildValue("s", state->response); +} + +static PyObject *authGSSClientUserName(PyObject *self, PyObject *args) +{ + gss_client_state *state; + PyObject *pystate; + + if (!PyArg_ParseTuple(args, "O", &pystate)) + return NULL; + + if (!PyCObject_Check(pystate)) { + PyErr_SetString(PyExc_TypeError, "Expected a context object"); + return NULL; + } + + state = (gss_client_state *)PyCObject_AsVoidPtr(pystate); + if (state == NULL) + return NULL; + + return Py_BuildValue("s", state->username); +} + +static PyObject *authGSSClientUnwrap(PyObject *self, PyObject *args) +{ + gss_client_state *state; + PyObject *pystate; + char *challenge = NULL; + int result = 0; + + if (!PyArg_ParseTuple(args, "Os", &pystate, &challenge)) + return NULL; + + if (!PyCObject_Check(pystate)) { + PyErr_SetString(PyExc_TypeError, "Expected a context object"); + return NULL; + } + + state = (gss_client_state *)PyCObject_AsVoidPtr(pystate); + if (state == NULL) + return NULL; + + result = authenticate_gss_client_unwrap(state, challenge); + if (result == AUTH_GSS_ERROR) + return NULL; + + return Py_BuildValue("i", result); +} + +static PyObject *authGSSClientWrap(PyObject *self, PyObject *args) +{ + gss_client_state *state; + PyObject *pystate; + char *challenge = NULL; + char *user = NULL; + int result = 0; + + if (!PyArg_ParseTuple(args, "Os|z", &pystate, &challenge, &user)) + return NULL; + + if (!PyCObject_Check(pystate)) { + PyErr_SetString(PyExc_TypeError, "Expected a context object"); + return NULL; + } + + state = (gss_client_state *)PyCObject_AsVoidPtr(pystate); + if (state == NULL) + return NULL; + + result = authenticate_gss_client_wrap(state, challenge, user); + if (result == AUTH_GSS_ERROR) + return NULL; + + return Py_BuildValue("i", result); +} + +static PyObject *authGSSServerInit(PyObject *self, PyObject *args) +{ + const char *service = NULL; + gss_server_state *state; + PyObject *pystate; + int result = 0; + + if (!PyArg_ParseTuple(args, "s", &service)) + return NULL; + + state = (gss_server_state *) malloc(sizeof(gss_server_state)); + pystate = PyCObject_FromVoidPtr(state, NULL); + + result = authenticate_gss_server_init(service, state); + if (result == AUTH_GSS_ERROR) + return NULL; + + return Py_BuildValue("(iO)", result, pystate); +} + +static PyObject *authGSSServerClean(PyObject *self, PyObject *args) +{ + gss_server_state *state; + PyObject *pystate; + int result = 0; + + if (!PyArg_ParseTuple(args, "O", &pystate)) + return NULL; + + if (!PyCObject_Check(pystate)) { + PyErr_SetString(PyExc_TypeError, "Expected a context object"); + return NULL; + } + + state = (gss_server_state *)PyCObject_AsVoidPtr(pystate); + if (state != NULL) + { + result = authenticate_gss_server_clean(state); + + free(state); + PyCObject_SetVoidPtr(pystate, NULL); + } + + return Py_BuildValue("i", result); +} + +static PyObject *authGSSServerStep(PyObject *self, PyObject *args) +{ + gss_server_state *state; + PyObject *pystate; + char *challenge = NULL; + int result = 0; + + if (!PyArg_ParseTuple(args, "Os", &pystate, &challenge)) + return NULL; + + if (!PyCObject_Check(pystate)) { + PyErr_SetString(PyExc_TypeError, "Expected a context object"); + return NULL; + } + + state = (gss_server_state *)PyCObject_AsVoidPtr(pystate); + if (state == NULL) + return NULL; + + result = authenticate_gss_server_step(state, challenge); + if (result == AUTH_GSS_ERROR) + return NULL; + + return Py_BuildValue("i", result); +} + +static PyObject *authGSSServerResponse(PyObject *self, PyObject *args) +{ + gss_server_state *state; + PyObject *pystate; + + if (!PyArg_ParseTuple(args, "O", &pystate)) + return NULL; + + if (!PyCObject_Check(pystate)) { + PyErr_SetString(PyExc_TypeError, "Expected a context object"); + return NULL; + } + + state = (gss_server_state *)PyCObject_AsVoidPtr(pystate); + if (state == NULL) + return NULL; + + return Py_BuildValue("s", state->response); +} + +static PyObject *authGSSServerUserName(PyObject *self, PyObject *args) +{ + gss_server_state *state; + PyObject *pystate; + + if (!PyArg_ParseTuple(args, "O", &pystate)) + return NULL; + + if (!PyCObject_Check(pystate)) { + PyErr_SetString(PyExc_TypeError, "Expected a context object"); + return NULL; + } + + state = (gss_server_state *)PyCObject_AsVoidPtr(pystate); + if (state == NULL) + return NULL; + + return Py_BuildValue("s", state->username); +} + +static PyObject *authGSSServerTargetName(PyObject *self, PyObject *args) +{ + gss_server_state *state; + PyObject *pystate; + + if (!PyArg_ParseTuple(args, "O", &pystate)) + return NULL; + + if (!PyCObject_Check(pystate)) { + PyErr_SetString(PyExc_TypeError, "Expected a context object"); + return NULL; + } + + state = (gss_server_state *)PyCObject_AsVoidPtr(pystate); + if (state == NULL) + return NULL; + + return Py_BuildValue("s", state->targetname); +} + +static PyMethodDef KerberosMethods[] = { + {"checkPassword", checkPassword, METH_VARARGS, + "Check the supplied user/password against Kerberos KDC."}, + {"changePassword", changePassword, METH_VARARGS, + "Change the user password."}, + {"getServerPrincipalDetails", getServerPrincipalDetails, METH_VARARGS, + "Return the service principal for a given service and hostname."}, + {"authGSSClientInit", (PyCFunction)authGSSClientInit, METH_VARARGS | METH_KEYWORDS, + "Initialize client-side GSSAPI operations."}, + {"authGSSClientClean", authGSSClientClean, METH_VARARGS, + "Terminate client-side GSSAPI operations."}, + {"authGSSClientStep", authGSSClientStep, METH_VARARGS, + "Do a client-side GSSAPI step."}, + {"authGSSClientResponse", authGSSClientResponse, METH_VARARGS, + "Get the response from the last client-side GSSAPI step."}, + {"authGSSClientUserName", authGSSClientUserName, METH_VARARGS, + "Get the user name from the last client-side GSSAPI step."}, + {"authGSSServerInit", authGSSServerInit, METH_VARARGS, + "Initialize server-side GSSAPI operations."}, + {"authGSSClientWrap", authGSSClientWrap, METH_VARARGS, + "Do a GSSAPI wrap."}, + {"authGSSClientUnwrap", authGSSClientUnwrap, METH_VARARGS, + "Do a GSSAPI unwrap."}, + {"authGSSServerClean", authGSSServerClean, METH_VARARGS, + "Terminate server-side GSSAPI operations."}, + {"authGSSServerStep", authGSSServerStep, METH_VARARGS, + "Do a server-side GSSAPI step."}, + {"authGSSServerResponse", authGSSServerResponse, METH_VARARGS, + "Get the response from the last server-side GSSAPI step."}, + {"authGSSServerUserName", authGSSServerUserName, METH_VARARGS, + "Get the user name from the last server-side GSSAPI step."}, + {"authGSSServerTargetName", authGSSServerTargetName, METH_VARARGS, + "Get the target name from the last server-side GSSAPI step."}, + {NULL, NULL, 0, NULL} /* Sentinel */ +}; + +PyMODINIT_FUNC initkerberos(void) +{ + PyObject *m,*d; + + m = Py_InitModule("kerberos", KerberosMethods); + + d = PyModule_GetDict(m); + + /* create the base exception class */ + if (!(KrbException_class = PyErr_NewException("kerberos.KrbError", NULL, NULL))) + goto error; + PyDict_SetItemString(d, "KrbError", KrbException_class); + Py_INCREF(KrbException_class); + + /* ...and the derived exceptions */ + if (!(BasicAuthException_class = PyErr_NewException("kerberos.BasicAuthError", KrbException_class, NULL))) + goto error; + Py_INCREF(BasicAuthException_class); + PyDict_SetItemString(d, "BasicAuthError", BasicAuthException_class); + + if (!(PwdChangeException_class = PyErr_NewException("kerberos.PwdChangeError", KrbException_class, NULL))) + goto error; + Py_INCREF(PwdChangeException_class); + PyDict_SetItemString(d, "PwdChangeError", PwdChangeException_class); + + if (!(GssException_class = PyErr_NewException("kerberos.GSSError", KrbException_class, NULL))) + goto error; + Py_INCREF(GssException_class); + PyDict_SetItemString(d, "GSSError", GssException_class); + + PyDict_SetItemString(d, "AUTH_GSS_COMPLETE", PyInt_FromLong(AUTH_GSS_COMPLETE)); + PyDict_SetItemString(d, "AUTH_GSS_CONTINUE", PyInt_FromLong(AUTH_GSS_CONTINUE)); + + PyDict_SetItemString(d, "GSS_C_DELEG_FLAG", PyInt_FromLong(GSS_C_DELEG_FLAG)); + PyDict_SetItemString(d, "GSS_C_MUTUAL_FLAG", PyInt_FromLong(GSS_C_MUTUAL_FLAG)); + PyDict_SetItemString(d, "GSS_C_REPLAY_FLAG", PyInt_FromLong(GSS_C_REPLAY_FLAG)); + PyDict_SetItemString(d, "GSS_C_SEQUENCE_FLAG", PyInt_FromLong(GSS_C_SEQUENCE_FLAG)); + PyDict_SetItemString(d, "GSS_C_CONF_FLAG", PyInt_FromLong(GSS_C_CONF_FLAG)); + PyDict_SetItemString(d, "GSS_C_INTEG_FLAG", PyInt_FromLong(GSS_C_INTEG_FLAG)); + PyDict_SetItemString(d, "GSS_C_ANON_FLAG", PyInt_FromLong(GSS_C_ANON_FLAG)); + PyDict_SetItemString(d, "GSS_C_PROT_READY_FLAG", PyInt_FromLong(GSS_C_PROT_READY_FLAG)); + PyDict_SetItemString(d, "GSS_C_TRANS_FLAG", PyInt_FromLong(GSS_C_TRANS_FLAG)); + +error: + if (PyErr_Occurred()) + PyErr_SetString(PyExc_ImportError, "kerberos: init failed"); +} diff --git a/src/.svn/text-base/kerberosbasic.c.svn-base b/src/.svn/text-base/kerberosbasic.c.svn-base new file mode 100644 index 0000000..0c7bdd7 --- /dev/null +++ b/src/.svn/text-base/kerberosbasic.c.svn-base @@ -0,0 +1,151 @@ +/** + * Copyright (c) 2006-2013 Apple Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +#include <Python.h> +#include "kerberosbasic.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#undef PRINTFS + +extern PyObject *BasicAuthException_class; +static void set_basicauth_error(krb5_context context, krb5_error_code code); + +static krb5_error_code verify_krb5_user(krb5_context context, krb5_principal principal, const char *password, krb5_principal server); + +int authenticate_user_krb5pwd(const char *user, const char *pswd, const char *service, const char *default_realm) +{ + krb5_context kcontext = NULL; + krb5_error_code code; + krb5_principal client = NULL; + krb5_principal server = NULL; + int ret = 0; + char *name = NULL; + char *p = NULL; + + code = krb5_init_context(&kcontext); + if (code) + { + PyErr_SetObject(BasicAuthException_class, Py_BuildValue("((s:i))", + "Cannot initialize Kerberos5 context", code)); + return 0; + } + + ret = krb5_parse_name (kcontext, service, &server); + + if (ret) + { + set_basicauth_error(kcontext, ret); + ret = 0; + goto end; + } + + code = krb5_unparse_name(kcontext, server, &name); + if (code) + { + set_basicauth_error(kcontext, code); + ret = 0; + goto end; + } +#ifdef PRINTFS + printf("Using %s as server principal for password verification\n", name); +#endif + free(name); + name = NULL; + + name = (char *)malloc(256); + p = strchr(user, '@'); + if (p == NULL) + { + snprintf(name, 256, "%s@%s", user, default_realm); + } + else + { + snprintf(name, 256, "%s", user); + } + + code = krb5_parse_name(kcontext, name, &client); + if (code) + { + set_basicauth_error(kcontext, code); + ret = 0; + goto end; + } + + code = verify_krb5_user(kcontext, client, pswd, server); + + if (code) + { + ret = 0; + goto end; + } + + ret = 1; + +end: +#ifdef PRINTFS + printf("kerb_authenticate_user_krb5pwd ret=%d user=%s authtype=%s\n", ret, user, "Basic"); +#endif + if (name) + free(name); + if (client) + krb5_free_principal(kcontext, client); + if (server) + krb5_free_principal(kcontext, server); + krb5_free_context(kcontext); + + return ret; +} + +/* Inspired by krb5_verify_user from Heimdal */ +static krb5_error_code verify_krb5_user(krb5_context context, krb5_principal principal, const char *password, krb5_principal server) +{ + krb5_creds creds; + krb5_get_init_creds_opt gic_options; + krb5_error_code ret; + char *name = NULL; + + memset(&creds, 0, sizeof(creds)); + + ret = krb5_unparse_name(context, principal, &name); + if (ret == 0) + { +#ifdef PRINTFS + printf("Trying to get TGT for user %s\n", name); +#endif + free(name); + } + + krb5_get_init_creds_opt_init(&gic_options); + ret = krb5_get_init_creds_password(context, &creds, principal, (char *)password, NULL, NULL, 0, NULL, &gic_options); + if (ret) + { + set_basicauth_error(context, ret); + goto end; + } + +end: + krb5_free_cred_contents(context, &creds); + + return ret; +} + +static void set_basicauth_error(krb5_context context, krb5_error_code code) +{ + PyErr_SetObject(BasicAuthException_class, Py_BuildValue("(s:i)", krb5_get_err_text(context, code), code)); +} diff --git a/src/.svn/text-base/kerberosbasic.h.svn-base b/src/.svn/text-base/kerberosbasic.h.svn-base new file mode 100644 index 0000000..0a91455 --- /dev/null +++ b/src/.svn/text-base/kerberosbasic.h.svn-base @@ -0,0 +1,23 @@ +/** + * Copyright (c) 2006-2013 Apple Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +#include <gssapi/gssapi.h> +#include <gssapi/gssapi_generic.h> +#include <gssapi/gssapi_krb5.h> + +#define krb5_get_err_text(context,code) error_message(code) + +int authenticate_user_krb5pwd(const char *user, const char *pswd, const char *service, const char *default_realm); diff --git a/src/.svn/text-base/kerberosgss.c.svn-base b/src/.svn/text-base/kerberosgss.c.svn-base new file mode 100644 index 0000000..af8abc1 --- /dev/null +++ b/src/.svn/text-base/kerberosgss.c.svn-base @@ -0,0 +1,651 @@ +/** + * Copyright (c) 2006-2013 Apple Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +#include <Python.h> +#include "kerberosgss.h" + +#include "base64.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <arpa/inet.h> + +static void set_gss_error(OM_uint32 err_maj, OM_uint32 err_min); + +extern PyObject *GssException_class; +extern PyObject *KrbException_class; + +char* server_principal_details(const char* service, const char* hostname) +{ + char match[1024]; + size_t match_len = 0; + char* result = NULL; + + int code; + krb5_context kcontext; + krb5_keytab kt = NULL; + krb5_kt_cursor cursor = NULL; + krb5_keytab_entry entry; + char* pname = NULL; + + // Generate the principal prefix we want to match + snprintf(match, 1024, "%s/%s@", service, hostname); + match_len = strlen(match); + + code = krb5_init_context(&kcontext); + if (code) + { + PyErr_SetObject(KrbException_class, Py_BuildValue("((s:i))", + "Cannot initialize Kerberos5 context", code)); + return NULL; + } + + if ((code = krb5_kt_default(kcontext, &kt))) + { + PyErr_SetObject(KrbException_class, Py_BuildValue("((s:i))", + "Cannot get default keytab", code)); + goto end; + } + + if ((code = krb5_kt_start_seq_get(kcontext, kt, &cursor))) + { + PyErr_SetObject(KrbException_class, Py_BuildValue("((s:i))", + "Cannot get sequence cursor from keytab", code)); + goto end; + } + + while ((code = krb5_kt_next_entry(kcontext, kt, &entry, &cursor)) == 0) + { + if ((code = krb5_unparse_name(kcontext, entry.principal, &pname))) + { + PyErr_SetObject(KrbException_class, Py_BuildValue("((s:i))", + "Cannot parse principal name from keytab", code)); + goto end; + } + + if (strncmp(pname, match, match_len) == 0) + { + result = malloc(strlen(pname) + 1); + strcpy(result, pname); + krb5_free_unparsed_name(kcontext, pname); + krb5_free_keytab_entry_contents(kcontext, &entry); + break; + } + + krb5_free_unparsed_name(kcontext, pname); + krb5_free_keytab_entry_contents(kcontext, &entry); + } + + if (result == NULL) + { + PyErr_SetObject(KrbException_class, Py_BuildValue("((s:i))", + "Principal not found in keytab", -1)); + } + +end: + if (cursor) + krb5_kt_end_seq_get(kcontext, kt, &cursor); + if (kt) + krb5_kt_close(kcontext, kt); + krb5_free_context(kcontext); + + return result; +} + +int authenticate_gss_client_init(const char* service, const char* principal, long int gss_flags, gss_client_state* state) +{ + OM_uint32 maj_stat; + OM_uint32 min_stat; + gss_buffer_desc name_token = GSS_C_EMPTY_BUFFER; + gss_buffer_desc principal_token = GSS_C_EMPTY_BUFFER; + int ret = AUTH_GSS_COMPLETE; + + state->server_name = GSS_C_NO_NAME; + state->context = GSS_C_NO_CONTEXT; + state->gss_flags = gss_flags; + state->client_creds = GSS_C_NO_CREDENTIAL; + state->username = NULL; + state->response = NULL; + + // Import server name first + name_token.length = strlen(service); + name_token.value = (char *)service; + + maj_stat = gss_import_name(&min_stat, &name_token, gss_krb5_nt_service_name, &state->server_name); + + if (GSS_ERROR(maj_stat)) + { + set_gss_error(maj_stat, min_stat); + ret = AUTH_GSS_ERROR; + goto end; + } + + // Get credential for principal + if (principal && *principal) + { + gss_name_t name; + principal_token.length = strlen(principal); + principal_token.value = (char *)principal; + + maj_stat = gss_import_name(&min_stat, &principal_token, GSS_C_NT_USER_NAME, &name); + if (GSS_ERROR(maj_stat)) + { + set_gss_error(maj_stat, min_stat); + ret = AUTH_GSS_ERROR; + goto end; + } + + maj_stat = gss_acquire_cred(&min_stat, name, GSS_C_INDEFINITE, GSS_C_NO_OID_SET, GSS_C_INITIATE, + &state->client_creds, NULL, NULL); + if (GSS_ERROR(maj_stat)) + { + set_gss_error(maj_stat, min_stat); + ret = AUTH_GSS_ERROR; + goto end; + } + + maj_stat = gss_release_name(&min_stat, &name); + if (GSS_ERROR(maj_stat)) + { + set_gss_error(maj_stat, min_stat); + ret = AUTH_GSS_ERROR; + goto end; + } + + } + +end: + return ret; +} + +int authenticate_gss_client_clean(gss_client_state *state) +{ + OM_uint32 maj_stat; + OM_uint32 min_stat; + int ret = AUTH_GSS_COMPLETE; + + if (state->context != GSS_C_NO_CONTEXT) + maj_stat = gss_delete_sec_context(&min_stat, &state->context, GSS_C_NO_BUFFER); + if (state->server_name != GSS_C_NO_NAME) + maj_stat = gss_release_name(&min_stat, &state->server_name); + if (state->client_creds != GSS_C_NO_CREDENTIAL) + maj_stat = gss_release_cred(&min_stat, &state->client_creds); + if (state->username != NULL) + { + free(state->username); + state->username = NULL; + } + if (state->response != NULL) + { + free(state->response); + state->response = NULL; + } + + return ret; +} + +int authenticate_gss_client_step(gss_client_state* state, const char* challenge) +{ + OM_uint32 maj_stat; + OM_uint32 min_stat; + gss_buffer_desc input_token = GSS_C_EMPTY_BUFFER; + gss_buffer_desc output_token = GSS_C_EMPTY_BUFFER; + int ret = AUTH_GSS_CONTINUE; + + // Always clear out the old response + if (state->response != NULL) + { + free(state->response); + state->response = NULL; + } + + // If there is a challenge (data from the server) we need to give it to GSS + if (challenge && *challenge) + { + size_t len; + input_token.value = base64_decode(challenge, &len); + input_token.length = len; + } + + // Do GSSAPI step + Py_BEGIN_ALLOW_THREADS + maj_stat = gss_init_sec_context(&min_stat, + state->client_creds, + &state->context, + state->server_name, + GSS_C_NO_OID, + (OM_uint32)state->gss_flags, + 0, + GSS_C_NO_CHANNEL_BINDINGS, + &input_token, + NULL, + &output_token, + NULL, + NULL); + Py_END_ALLOW_THREADS + + if ((maj_stat != GSS_S_COMPLETE) && (maj_stat != GSS_S_CONTINUE_NEEDED)) + { + set_gss_error(maj_stat, min_stat); + ret = AUTH_GSS_ERROR; + goto end; + } + + ret = (maj_stat == GSS_S_COMPLETE) ? AUTH_GSS_COMPLETE : AUTH_GSS_CONTINUE; + // Grab the client response to send back to the server + if (output_token.length) + { + state->response = base64_encode((const unsigned char *)output_token.value, output_token.length);; + maj_stat = gss_release_buffer(&min_stat, &output_token); + } + + // Try to get the user name if we have completed all GSS operations + if (ret == AUTH_GSS_COMPLETE) + { + gss_name_t gssuser = GSS_C_NO_NAME; + maj_stat = gss_inquire_context(&min_stat, state->context, &gssuser, NULL, NULL, NULL, NULL, NULL, NULL); + if (GSS_ERROR(maj_stat)) + { + set_gss_error(maj_stat, min_stat); + ret = AUTH_GSS_ERROR; + goto end; + } + + gss_buffer_desc name_token; + name_token.length = 0; + maj_stat = gss_display_name(&min_stat, gssuser, &name_token, NULL); + if (GSS_ERROR(maj_stat)) + { + if (name_token.value) + gss_release_buffer(&min_stat, &name_token); + gss_release_name(&min_stat, &gssuser); + + set_gss_error(maj_stat, min_stat); + ret = AUTH_GSS_ERROR; + goto end; + } + else + { + state->username = (char *)malloc(name_token.length + 1); + strncpy(state->username, (char*) name_token.value, name_token.length); + state->username[name_token.length] = 0; + gss_release_buffer(&min_stat, &name_token); + gss_release_name(&min_stat, &gssuser); + } + } +end: + if (output_token.value) + gss_release_buffer(&min_stat, &output_token); + if (input_token.value) + free(input_token.value); + return ret; +} + +int authenticate_gss_client_unwrap(gss_client_state *state, const char *challenge) +{ + OM_uint32 maj_stat; + OM_uint32 min_stat; + gss_buffer_desc input_token = GSS_C_EMPTY_BUFFER; + gss_buffer_desc output_token = GSS_C_EMPTY_BUFFER; + int ret = AUTH_GSS_CONTINUE; + + // Always clear out the old response + if (state->response != NULL) + { + free(state->response); + state->response = NULL; + } + + // If there is a challenge (data from the server) we need to give it to GSS + if (challenge && *challenge) + { + size_t len; + input_token.value = base64_decode(challenge, &len); + input_token.length = len; + } + + // Do GSSAPI step + maj_stat = gss_unwrap(&min_stat, + state->context, + &input_token, + &output_token, + NULL, + NULL); + + if (maj_stat != GSS_S_COMPLETE) + { + set_gss_error(maj_stat, min_stat); + ret = AUTH_GSS_ERROR; + goto end; + } + else + ret = AUTH_GSS_COMPLETE; + + // Grab the client response + if (output_token.length) + { + state->response = base64_encode((const unsigned char *)output_token.value, output_token.length); + maj_stat = gss_release_buffer(&min_stat, &output_token); + } +end: + if (output_token.value) + gss_release_buffer(&min_stat, &output_token); + if (input_token.value) + free(input_token.value); + return ret; +} + +int authenticate_gss_client_wrap(gss_client_state* state, const char* challenge, const char* user) +{ + OM_uint32 maj_stat; + OM_uint32 min_stat; + gss_buffer_desc input_token = GSS_C_EMPTY_BUFFER; + gss_buffer_desc output_token = GSS_C_EMPTY_BUFFER; + int ret = AUTH_GSS_CONTINUE; + char buf[4096], server_conf_flags; + unsigned long buf_size; + + // Always clear out the old response + if (state->response != NULL) + { + free(state->response); + state->response = NULL; + } + + if (challenge && *challenge) + { + size_t len; + input_token.value = base64_decode(challenge, &len); + input_token.length = len; + } + + if (user) { + // get bufsize + server_conf_flags = ((char*) input_token.value)[0]; + ((char*) input_token.value)[0] = 0; + buf_size = ntohl(*((long *) input_token.value)); + free(input_token.value); +#ifdef PRINTFS + printf("User: %s, %c%c%c\n", user, + server_conf_flags & GSS_AUTH_P_NONE ? 'N' : '-', + server_conf_flags & GSS_AUTH_P_INTEGRITY ? 'I' : '-', + server_conf_flags & GSS_AUTH_P_PRIVACY ? 'P' : '-'); + printf("Maximum GSS token size is %ld\n", buf_size); +#endif + + // agree to terms (hack!) + buf_size = htonl(buf_size); // not relevant without integrity/privacy + memcpy(buf, &buf_size, 4); + buf[0] = GSS_AUTH_P_NONE; + // server decides if principal can log in as user + strncpy(buf + 4, user, sizeof(buf) - 4); + input_token.value = buf; + input_token.length = 4 + strlen(user); + } + + // Do GSSAPI wrap + maj_stat = gss_wrap(&min_stat, + state->context, + 0, + GSS_C_QOP_DEFAULT, + &input_token, + NULL, + &output_token); + + if (maj_stat != GSS_S_COMPLETE) + { + set_gss_error(maj_stat, min_stat); + ret = AUTH_GSS_ERROR; + goto end; + } + else + ret = AUTH_GSS_COMPLETE; + // Grab the client response to send back to the server + if (output_token.length) + { + state->response = base64_encode((const unsigned char *)output_token.value, output_token.length);; + maj_stat = gss_release_buffer(&min_stat, &output_token); + } +end: + if (output_token.value) + gss_release_buffer(&min_stat, &output_token); + return ret; +} + +int authenticate_gss_server_init(const char *service, gss_server_state *state) +{ + OM_uint32 maj_stat; + OM_uint32 min_stat; + gss_buffer_desc name_token = GSS_C_EMPTY_BUFFER; + int ret = AUTH_GSS_COMPLETE; + + state->context = GSS_C_NO_CONTEXT; + state->server_name = GSS_C_NO_NAME; + state->client_name = GSS_C_NO_NAME; + state->server_creds = GSS_C_NO_CREDENTIAL; + state->client_creds = GSS_C_NO_CREDENTIAL; + state->username = NULL; + state->targetname = NULL; + state->response = NULL; + + // Server name may be empty which means we aren't going to create our own creds + size_t service_len = strlen(service); + if (service_len != 0) + { + // Import server name first + name_token.length = strlen(service); + name_token.value = (char *)service; + + maj_stat = gss_import_name(&min_stat, &name_token, GSS_C_NT_HOSTBASED_SERVICE, &state->server_name); + + if (GSS_ERROR(maj_stat)) + { + set_gss_error(maj_stat, min_stat); + ret = AUTH_GSS_ERROR; + goto end; + } + + // Get credentials + maj_stat = gss_acquire_cred(&min_stat, state->server_name, GSS_C_INDEFINITE, + GSS_C_NO_OID_SET, GSS_C_ACCEPT, &state->server_creds, NULL, NULL); + + if (GSS_ERROR(maj_stat)) + { + set_gss_error(maj_stat, min_stat); + ret = AUTH_GSS_ERROR; + goto end; + } + } + +end: + return ret; +} + +int authenticate_gss_server_clean(gss_server_state *state) +{ + OM_uint32 maj_stat; + OM_uint32 min_stat; + int ret = AUTH_GSS_COMPLETE; + + if (state->context != GSS_C_NO_CONTEXT) + maj_stat = gss_delete_sec_context(&min_stat, &state->context, GSS_C_NO_BUFFER); + if (state->server_name != GSS_C_NO_NAME) + maj_stat = gss_release_name(&min_stat, &state->server_name); + if (state->client_name != GSS_C_NO_NAME) + maj_stat = gss_release_name(&min_stat, &state->client_name); + if (state->server_creds != GSS_C_NO_CREDENTIAL) + maj_stat = gss_release_cred(&min_stat, &state->server_creds); + if (state->client_creds != GSS_C_NO_CREDENTIAL) + maj_stat = gss_release_cred(&min_stat, &state->client_creds); + if (state->username != NULL) + { + free(state->username); + state->username = NULL; + } + if (state->targetname != NULL) + { + free(state->targetname); + state->targetname = NULL; + } + if (state->response != NULL) + { + free(state->response); + state->response = NULL; + } + + return ret; +} + +int authenticate_gss_server_step(gss_server_state *state, const char *challenge) +{ + OM_uint32 maj_stat; + OM_uint32 min_stat; + gss_buffer_desc input_token = GSS_C_EMPTY_BUFFER; + gss_buffer_desc output_token = GSS_C_EMPTY_BUFFER; + int ret = AUTH_GSS_CONTINUE; + + // Always clear out the old response + if (state->response != NULL) + { + free(state->response); + state->response = NULL; + } + + // If there is a challenge (data from the server) we need to give it to GSS + if (challenge && *challenge) + { + size_t len; + input_token.value = base64_decode(challenge, &len); + input_token.length = len; + } + else + { + PyErr_SetString(KrbException_class, "No challenge parameter in request from client"); + ret = AUTH_GSS_ERROR; + goto end; + } + + Py_BEGIN_ALLOW_THREADS + maj_stat = gss_accept_sec_context(&min_stat, + &state->context, + state->server_creds, + &input_token, + GSS_C_NO_CHANNEL_BINDINGS, + &state->client_name, + NULL, + &output_token, + NULL, + NULL, + &state->client_creds); + Py_END_ALLOW_THREADS + + if (GSS_ERROR(maj_stat)) + { + set_gss_error(maj_stat, min_stat); + ret = AUTH_GSS_ERROR; + goto end; + } + + // Grab the server response to send back to the client + if (output_token.length) + { + state->response = base64_encode((const unsigned char *)output_token.value, output_token.length);; + maj_stat = gss_release_buffer(&min_stat, &output_token); + } + + // Get the user name + maj_stat = gss_display_name(&min_stat, state->client_name, &output_token, NULL); + if (GSS_ERROR(maj_stat)) + { + set_gss_error(maj_stat, min_stat); + ret = AUTH_GSS_ERROR; + goto end; + } + state->username = (char *)malloc(output_token.length + 1); + strncpy(state->username, (char*) output_token.value, output_token.length); + state->username[output_token.length] = 0; + + // Get the target name if no server creds were supplied + if (state->server_creds == GSS_C_NO_CREDENTIAL) + { + gss_name_t target_name = GSS_C_NO_NAME; + maj_stat = gss_inquire_context(&min_stat, state->context, NULL, &target_name, NULL, NULL, NULL, NULL, NULL); + if (GSS_ERROR(maj_stat)) + { + set_gss_error(maj_stat, min_stat); + ret = AUTH_GSS_ERROR; + goto end; + } + maj_stat = gss_display_name(&min_stat, target_name, &output_token, NULL); + if (GSS_ERROR(maj_stat)) + { + set_gss_error(maj_stat, min_stat); + ret = AUTH_GSS_ERROR; + goto end; + } + state->targetname = (char *)malloc(output_token.length + 1); + strncpy(state->targetname, (char*) output_token.value, output_token.length); + state->targetname[output_token.length] = 0; + } + + ret = AUTH_GSS_COMPLETE; + +end: + if (output_token.length) + gss_release_buffer(&min_stat, &output_token); + if (input_token.value) + free(input_token.value); + return ret; +} + + +static void set_gss_error(OM_uint32 err_maj, OM_uint32 err_min) +{ + OM_uint32 maj_stat, min_stat; + OM_uint32 msg_ctx = 0; + gss_buffer_desc status_string; + char buf_maj[512]; + char buf_min[512]; + + do + { + maj_stat = gss_display_status (&min_stat, + err_maj, + GSS_C_GSS_CODE, + GSS_C_NO_OID, + &msg_ctx, + &status_string); + if (GSS_ERROR(maj_stat)) + break; + strncpy(buf_maj, (char*) status_string.value, sizeof(buf_maj)); + gss_release_buffer(&min_stat, &status_string); + + maj_stat = gss_display_status (&min_stat, + err_min, + GSS_C_MECH_CODE, + GSS_C_NULL_OID, + &msg_ctx, + &status_string); + if (!GSS_ERROR(maj_stat)) + { + strncpy(buf_min, (char*) status_string.value, sizeof(buf_min)); + gss_release_buffer(&min_stat, &status_string); + } + } while (!GSS_ERROR(maj_stat) && msg_ctx != 0); + + PyErr_SetObject(GssException_class, Py_BuildValue("((s:i)(s:i))", buf_maj, err_maj, buf_min, err_min)); +} diff --git a/src/.svn/text-base/kerberosgss.h.svn-base b/src/.svn/text-base/kerberosgss.h.svn-base new file mode 100644 index 0000000..7d1f6e3 --- /dev/null +++ b/src/.svn/text-base/kerberosgss.h.svn-base @@ -0,0 +1,61 @@ +/** + * Copyright (c) 2006-2013 Apple Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +#include <gssapi/gssapi.h> +#include <gssapi/gssapi_generic.h> +#include <gssapi/gssapi_krb5.h> + +#define krb5_get_err_text(context,code) error_message(code) + +#define AUTH_GSS_ERROR -1 +#define AUTH_GSS_COMPLETE 1 +#define AUTH_GSS_CONTINUE 0 + +#define GSS_AUTH_P_NONE 1 +#define GSS_AUTH_P_INTEGRITY 2 +#define GSS_AUTH_P_PRIVACY 4 + +typedef struct { + gss_ctx_id_t context; + gss_name_t server_name; + long int gss_flags; + gss_cred_id_t client_creds; + char* username; + char* response; +} gss_client_state; + +typedef struct { + gss_ctx_id_t context; + gss_name_t server_name; + gss_name_t client_name; + gss_cred_id_t server_creds; + gss_cred_id_t client_creds; + char* username; + char* targetname; + char* response; +} gss_server_state; + +char* server_principal_details(const char* service, const char* hostname); + +int authenticate_gss_client_init(const char* service, const char* principal, long int gss_flags, gss_client_state* state); +int authenticate_gss_client_clean(gss_client_state *state); +int authenticate_gss_client_step(gss_client_state *state, const char *challenge); +int authenticate_gss_client_unwrap(gss_client_state* state, const char* challenge); +int authenticate_gss_client_wrap(gss_client_state* state, const char* challenge, const char* user); + +int authenticate_gss_server_init(const char* service, gss_server_state* state); +int authenticate_gss_server_clean(gss_server_state *state); +int authenticate_gss_server_step(gss_server_state *state, const char *challenge); diff --git a/src/.svn/text-base/kerberospw.c.svn-base b/src/.svn/text-base/kerberospw.c.svn-base new file mode 100644 index 0000000..47cf93e --- /dev/null +++ b/src/.svn/text-base/kerberospw.c.svn-base @@ -0,0 +1,137 @@ +/** + * Copyright (c) 2008 Guido Guenther <[email protected]> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +#include <Python.h> +#include "kerberospw.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#undef PRINTFS + +extern PyObject *PwdChangeException_class; + +static void set_pwchange_error(krb5_context context, krb5_error_code code) +{ + PyErr_SetObject(PwdChangeException_class, Py_BuildValue("(s:i)", + krb5_get_err_text(context, code), code)); +} + +/* Inspired by krb5_verify_user from Heimdal */ +static krb5_error_code verify_krb5_user(krb5_context context, + krb5_principal principal, + const char *password, + const char *service, + krb5_creds* creds) +{ + krb5_get_init_creds_opt gic_options; + krb5_error_code code; + int ret = 0; + +#ifdef PRINTFS + { + char *name = NULL; + code = krb5_unparse_name(context, principal, &name); + if (!code) + printf("Trying to get TGT for user %s\n", name); + free(name); + } +#endif + krb5_get_init_creds_opt_init(&gic_options); + krb5_get_init_creds_opt_set_forwardable(&gic_options, 0); + krb5_get_init_creds_opt_set_proxiable(&gic_options, 0); + krb5_get_init_creds_opt_set_renew_life(&gic_options, 0); + + memset(creds, 0, sizeof(krb5_creds)); + + code = krb5_get_init_creds_password(context, creds, principal, + (char *)password, NULL, NULL, 0, + (char *)service, &gic_options); + if (code) { + set_pwchange_error(context, code); + goto end; + } + ret = 1; /* success */ +end: + return ret; +} + +int change_user_krb5pwd(const char *user, const char* oldpswd, const char *newpswd) +{ + krb5_context kcontext = NULL; + krb5_error_code code; + krb5_principal client = NULL; + krb5_creds creds; + int ret = 0; + char *name = NULL; + const char* service = "kadmin/changepw"; + int result_code; + krb5_data result_code_string, result_string; + + code = krb5_init_context(&kcontext); + if (code) { + PyErr_SetObject(PwdChangeException_class, Py_BuildValue("((s:i))", + "Cannot initialize Kerberos5 context", + code)); + return 0; + } + + name = (char *)malloc(256); + snprintf(name, 256, "%s", user); + + code = krb5_parse_name(kcontext, name, &client); + if (code) { + set_pwchange_error(kcontext, code); + goto end; + } + + code = verify_krb5_user(kcontext, client, oldpswd, service, &creds); + if (!code) /* exception set by verify_krb5_user */ + goto end; + + code = krb5_change_password(kcontext, &creds, (char*)newpswd, + &result_code, &result_code_string, &result_string); + if (code) { + set_pwchange_error(kcontext, code); + goto end; + } + if (result_code) { + char *message = NULL; + asprintf(&message, "%.*s: %.*s", + (int) result_code_string.length, + (char *) result_code_string.data, + (int) result_string.length, + (char *) result_string.data); + PyErr_SetObject(PwdChangeException_class, Py_BuildValue("((s:i))", + message, result_code)); + free(message); + goto end; + } + + ret = 1; /* success */ +end: +#ifdef PRINTFS + printf("%s: ret=%d user=%s\n", __FUNCTION__, ret, name); +#endif + if (name) + free(name); + if (client) + krb5_free_principal(kcontext, client); + krb5_free_context(kcontext); + return ret; +} + diff --git a/src/.svn/text-base/kerberospw.h.svn-base b/src/.svn/text-base/kerberospw.h.svn-base new file mode 100644 index 0000000..578108a --- /dev/null +++ b/src/.svn/text-base/kerberospw.h.svn-base @@ -0,0 +1,24 @@ +/** + * Copyright (c) 2008 Guido Guenther <[email protected]> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + **/ + +#include <gssapi/gssapi.h> +#include <gssapi/gssapi_generic.h> +#include <gssapi/gssapi_krb5.h> + +#define krb5_get_err_text(context,code) error_message(code) + +int change_user_krb5pwd(const char *user, const char* oldpswd, const char *newpswd); diff --git a/src/base64.c b/src/base64.c new file mode 100644 index 0000000..877379f --- /dev/null +++ b/src/base64.c @@ -0,0 +1,120 @@ +/** + * Copyright (c) 2006-2013 Apple Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +#include "base64.h" + +#include <stdlib.h> +#include <string.h> + +// base64 tables +static char basis_64[] = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; +static signed char index_64[128] = +{ + -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, + -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, + -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,62, -1,-1,-1,63, + 52,53,54,55, 56,57,58,59, 60,61,-1,-1, -1,-1,-1,-1, + -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11,12,13,14, + 15,16,17,18, 19,20,21,22, 23,24,25,-1, -1,-1,-1,-1, + -1,26,27,28, 29,30,31,32, 33,34,35,36, 37,38,39,40, + 41,42,43,44, 45,46,47,48, 49,50,51,-1, -1,-1,-1,-1 +}; +#define CHAR64(c) (((c) < 0 || (c) > 127) ? -1 : index_64[(c)]) + +// base64_encode : base64 encode +// +// value : data to encode +// vlen : length of data +// (result) : new char[] - c-str of result +char *base64_encode(const unsigned char *value, size_t vlen) +{ + char *result = (char *)malloc((vlen * 4) / 3 + 5); + char *out = result; + while (vlen >= 3) + { + *out++ = basis_64[value[0] >> 2]; + *out++ = basis_64[((value[0] << 4) & 0x30) | (value[1] >> 4)]; + *out++ = basis_64[((value[1] << 2) & 0x3C) | (value[2] >> 6)]; + *out++ = basis_64[value[2] & 0x3F]; + value += 3; + vlen -= 3; + } + if (vlen > 0) + { + *out++ = basis_64[value[0] >> 2]; + unsigned char oval = (value[0] << 4) & 0x30; + if (vlen > 1) oval |= value[1] >> 4; + *out++ = basis_64[oval]; + *out++ = (vlen < 2) ? '=' : basis_64[(value[1] << 2) & 0x3C]; + *out++ = '='; + } + *out = '\0'; + + return result; +} + +// base64_decode : base64 decode +// +// value : c-str to decode +// rlen : length of decoded result +// (result) : new unsigned char[] - decoded result +unsigned char *base64_decode(const char *value, size_t *rlen) +{ + *rlen = 0; + int c1, c2, c3, c4; + + size_t vlen = strlen(value); + unsigned char *result =(unsigned char *)malloc((vlen * 3) / 4 + 1); + unsigned char *out = result; + + while (1) + { + if (value[0]==0) + return result; + c1 = value[0]; + if (CHAR64(c1) == -1) + goto base64_decode_error;; + c2 = value[1]; + if (CHAR64(c2) == -1) + goto base64_decode_error;; + c3 = value[2]; + if ((c3 != '=') && (CHAR64(c3) == -1)) + goto base64_decode_error;; + c4 = value[3]; + if ((c4 != '=') && (CHAR64(c4) == -1)) + goto base64_decode_error;; + + value += 4; + *out++ = (CHAR64(c1) << 2) | (CHAR64(c2) >> 4); + *rlen += 1; + if (c3 != '=') + { + *out++ = ((CHAR64(c2) << 4) & 0xf0) | (CHAR64(c3) >> 2); + *rlen += 1; + if (c4 != '=') + { + *out++ = ((CHAR64(c3) << 6) & 0xc0) | CHAR64(c4); + *rlen += 1; + } + } + } + +base64_decode_error: + *result = 0; + *rlen = 0; + return result; +} diff --git a/src/base64.h b/src/base64.h new file mode 100644 index 0000000..9ea9c6b --- /dev/null +++ b/src/base64.h @@ -0,0 +1,19 @@ +/** + * Copyright (c) 2006-2013 Apple Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +#include <stddef.h> +char *base64_encode(const unsigned char *value, size_t vlen); +unsigned char *base64_decode(const char *value, size_t *rlen); diff --git a/src/kerberos.c b/src/kerberos.c new file mode 100644 index 0000000..d65c7ff --- /dev/null +++ b/src/kerberos.c @@ -0,0 +1,468 @@ +/** + * Copyright (c) 2006-2013 Apple Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +#include <Python.h> + +#include "kerberosbasic.h" +#include "kerberospw.h" +#include "kerberosgss.h" + +PyObject *KrbException_class; +PyObject *BasicAuthException_class; +PyObject *PwdChangeException_class; +PyObject *GssException_class; + +static PyObject *checkPassword(PyObject *self, PyObject *args) +{ + 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)) + return NULL; + + result = authenticate_user_krb5pwd(user, pswd, service, default_realm); + + if (result) + return Py_INCREF(Py_True), Py_True; + else + return NULL; +} + +static PyObject *changePassword(PyObject *self, PyObject *args) +{ + const char *newpswd = NULL; + const char *oldpswd = NULL; + const char *user = NULL; + int result = 0; + + if (!PyArg_ParseTuple(args, "sss", &user, &oldpswd, &newpswd)) + return NULL; + + result = change_user_krb5pwd(user, oldpswd, newpswd); + + if (result) + return Py_INCREF(Py_True), Py_True; + else + return NULL; +} + +static PyObject *getServerPrincipalDetails(PyObject *self, PyObject *args) +{ + const char *service = NULL; + const char *hostname = NULL; + char* result; + + if (!PyArg_ParseTuple(args, "ss", &service, &hostname)) + return NULL; + + result = server_principal_details(service, hostname); + + if (result != NULL) + { + PyObject* pyresult = Py_BuildValue("s", result); + free(result); + return pyresult; + } + else + return NULL; +} + +static PyObject* authGSSClientInit(PyObject* self, PyObject* args, PyObject* keywds) +{ + const char *service = NULL; + const char *principal = NULL; + gss_client_state *state; + PyObject *pystate; + static char *kwlist[] = {"service", "principal", "gssflags", NULL}; + long int gss_flags = GSS_C_MUTUAL_FLAG | GSS_C_SEQUENCE_FLAG; + int result = 0; + + if (!PyArg_ParseTupleAndKeywords(args, keywds, "s|zl", kwlist, &service, &principal, &gss_flags)) + return NULL; + + state = (gss_client_state *) malloc(sizeof(gss_client_state)); + pystate = PyCObject_FromVoidPtr(state, NULL); + + result = authenticate_gss_client_init(service, principal, gss_flags, state); + if (result == AUTH_GSS_ERROR) + return NULL; + + return Py_BuildValue("(iO)", result, pystate); +} + +static PyObject *authGSSClientClean(PyObject *self, PyObject *args) +{ + gss_client_state *state; + PyObject *pystate; + int result = 0; + + if (!PyArg_ParseTuple(args, "O", &pystate)) + return NULL; + + if (!PyCObject_Check(pystate)) { + PyErr_SetString(PyExc_TypeError, "Expected a context object"); + return NULL; + } + + state = (gss_client_state *)PyCObject_AsVoidPtr(pystate); + if (state != NULL) + { + result = authenticate_gss_client_clean(state); + + free(state); + PyCObject_SetVoidPtr(pystate, NULL); + } + + return Py_BuildValue("i", result); +} + +static PyObject *authGSSClientStep(PyObject *self, PyObject *args) +{ + gss_client_state *state; + PyObject *pystate; + char *challenge = NULL; + int result = 0; + + if (!PyArg_ParseTuple(args, "Os", &pystate, &challenge)) + return NULL; + + if (!PyCObject_Check(pystate)) { + PyErr_SetString(PyExc_TypeError, "Expected a context object"); + return NULL; + } + + state = (gss_client_state *)PyCObject_AsVoidPtr(pystate); + if (state == NULL) + return NULL; + + result = authenticate_gss_client_step(state, challenge); + if (result == AUTH_GSS_ERROR) + return NULL; + + return Py_BuildValue("i", result); +} + +static PyObject *authGSSClientResponse(PyObject *self, PyObject *args) +{ + gss_client_state *state; + PyObject *pystate; + + if (!PyArg_ParseTuple(args, "O", &pystate)) + return NULL; + + if (!PyCObject_Check(pystate)) { + PyErr_SetString(PyExc_TypeError, "Expected a context object"); + return NULL; + } + + state = (gss_client_state *)PyCObject_AsVoidPtr(pystate); + if (state == NULL) + return NULL; + + return Py_BuildValue("s", state->response); +} + +static PyObject *authGSSClientUserName(PyObject *self, PyObject *args) +{ + gss_client_state *state; + PyObject *pystate; + + if (!PyArg_ParseTuple(args, "O", &pystate)) + return NULL; + + if (!PyCObject_Check(pystate)) { + PyErr_SetString(PyExc_TypeError, "Expected a context object"); + return NULL; + } + + state = (gss_client_state *)PyCObject_AsVoidPtr(pystate); + if (state == NULL) + return NULL; + + return Py_BuildValue("s", state->username); +} + +static PyObject *authGSSClientUnwrap(PyObject *self, PyObject *args) +{ + gss_client_state *state; + PyObject *pystate; + char *challenge = NULL; + int result = 0; + + if (!PyArg_ParseTuple(args, "Os", &pystate, &challenge)) + return NULL; + + if (!PyCObject_Check(pystate)) { + PyErr_SetString(PyExc_TypeError, "Expected a context object"); + return NULL; + } + + state = (gss_client_state *)PyCObject_AsVoidPtr(pystate); + if (state == NULL) + return NULL; + + result = authenticate_gss_client_unwrap(state, challenge); + if (result == AUTH_GSS_ERROR) + return NULL; + + return Py_BuildValue("i", result); +} + +static PyObject *authGSSClientWrap(PyObject *self, PyObject *args) +{ + gss_client_state *state; + PyObject *pystate; + char *challenge = NULL; + char *user = NULL; + int result = 0; + + if (!PyArg_ParseTuple(args, "Os|z", &pystate, &challenge, &user)) + return NULL; + + if (!PyCObject_Check(pystate)) { + PyErr_SetString(PyExc_TypeError, "Expected a context object"); + return NULL; + } + + state = (gss_client_state *)PyCObject_AsVoidPtr(pystate); + if (state == NULL) + return NULL; + + result = authenticate_gss_client_wrap(state, challenge, user); + if (result == AUTH_GSS_ERROR) + return NULL; + + return Py_BuildValue("i", result); +} + +static PyObject *authGSSServerInit(PyObject *self, PyObject *args) +{ + const char *service = NULL; + gss_server_state *state; + PyObject *pystate; + int result = 0; + + if (!PyArg_ParseTuple(args, "s", &service)) + return NULL; + + state = (gss_server_state *) malloc(sizeof(gss_server_state)); + pystate = PyCObject_FromVoidPtr(state, NULL); + + result = authenticate_gss_server_init(service, state); + if (result == AUTH_GSS_ERROR) + return NULL; + + return Py_BuildValue("(iO)", result, pystate); +} + +static PyObject *authGSSServerClean(PyObject *self, PyObject *args) +{ + gss_server_state *state; + PyObject *pystate; + int result = 0; + + if (!PyArg_ParseTuple(args, "O", &pystate)) + return NULL; + + if (!PyCObject_Check(pystate)) { + PyErr_SetString(PyExc_TypeError, "Expected a context object"); + return NULL; + } + + state = (gss_server_state *)PyCObject_AsVoidPtr(pystate); + if (state != NULL) + { + result = authenticate_gss_server_clean(state); + + free(state); + PyCObject_SetVoidPtr(pystate, NULL); + } + + return Py_BuildValue("i", result); +} + +static PyObject *authGSSServerStep(PyObject *self, PyObject *args) +{ + gss_server_state *state; + PyObject *pystate; + char *challenge = NULL; + int result = 0; + + if (!PyArg_ParseTuple(args, "Os", &pystate, &challenge)) + return NULL; + + if (!PyCObject_Check(pystate)) { + PyErr_SetString(PyExc_TypeError, "Expected a context object"); + return NULL; + } + + state = (gss_server_state *)PyCObject_AsVoidPtr(pystate); + if (state == NULL) + return NULL; + + result = authenticate_gss_server_step(state, challenge); + if (result == AUTH_GSS_ERROR) + return NULL; + + return Py_BuildValue("i", result); +} + +static PyObject *authGSSServerResponse(PyObject *self, PyObject *args) +{ + gss_server_state *state; + PyObject *pystate; + + if (!PyArg_ParseTuple(args, "O", &pystate)) + return NULL; + + if (!PyCObject_Check(pystate)) { + PyErr_SetString(PyExc_TypeError, "Expected a context object"); + return NULL; + } + + state = (gss_server_state *)PyCObject_AsVoidPtr(pystate); + if (state == NULL) + return NULL; + + return Py_BuildValue("s", state->response); +} + +static PyObject *authGSSServerUserName(PyObject *self, PyObject *args) +{ + gss_server_state *state; + PyObject *pystate; + + if (!PyArg_ParseTuple(args, "O", &pystate)) + return NULL; + + if (!PyCObject_Check(pystate)) { + PyErr_SetString(PyExc_TypeError, "Expected a context object"); + return NULL; + } + + state = (gss_server_state *)PyCObject_AsVoidPtr(pystate); + if (state == NULL) + return NULL; + + return Py_BuildValue("s", state->username); +} + +static PyObject *authGSSServerTargetName(PyObject *self, PyObject *args) +{ + gss_server_state *state; + PyObject *pystate; + + if (!PyArg_ParseTuple(args, "O", &pystate)) + return NULL; + + if (!PyCObject_Check(pystate)) { + PyErr_SetString(PyExc_TypeError, "Expected a context object"); + return NULL; + } + + state = (gss_server_state *)PyCObject_AsVoidPtr(pystate); + if (state == NULL) + return NULL; + + return Py_BuildValue("s", state->targetname); +} + +static PyMethodDef KerberosMethods[] = { + {"checkPassword", checkPassword, METH_VARARGS, + "Check the supplied user/password against Kerberos KDC."}, + {"changePassword", changePassword, METH_VARARGS, + "Change the user password."}, + {"getServerPrincipalDetails", getServerPrincipalDetails, METH_VARARGS, + "Return the service principal for a given service and hostname."}, + {"authGSSClientInit", (PyCFunction)authGSSClientInit, METH_VARARGS | METH_KEYWORDS, + "Initialize client-side GSSAPI operations."}, + {"authGSSClientClean", authGSSClientClean, METH_VARARGS, + "Terminate client-side GSSAPI operations."}, + {"authGSSClientStep", authGSSClientStep, METH_VARARGS, + "Do a client-side GSSAPI step."}, + {"authGSSClientResponse", authGSSClientResponse, METH_VARARGS, + "Get the response from the last client-side GSSAPI step."}, + {"authGSSClientUserName", authGSSClientUserName, METH_VARARGS, + "Get the user name from the last client-side GSSAPI step."}, + {"authGSSServerInit", authGSSServerInit, METH_VARARGS, + "Initialize server-side GSSAPI operations."}, + {"authGSSClientWrap", authGSSClientWrap, METH_VARARGS, + "Do a GSSAPI wrap."}, + {"authGSSClientUnwrap", authGSSClientUnwrap, METH_VARARGS, + "Do a GSSAPI unwrap."}, + {"authGSSServerClean", authGSSServerClean, METH_VARARGS, + "Terminate server-side GSSAPI operations."}, + {"authGSSServerStep", authGSSServerStep, METH_VARARGS, + "Do a server-side GSSAPI step."}, + {"authGSSServerResponse", authGSSServerResponse, METH_VARARGS, + "Get the response from the last server-side GSSAPI step."}, + {"authGSSServerUserName", authGSSServerUserName, METH_VARARGS, + "Get the user name from the last server-side GSSAPI step."}, + {"authGSSServerTargetName", authGSSServerTargetName, METH_VARARGS, + "Get the target name from the last server-side GSSAPI step."}, + {NULL, NULL, 0, NULL} /* Sentinel */ +}; + +PyMODINIT_FUNC initkerberos(void) +{ + PyObject *m,*d; + + m = Py_InitModule("kerberos", KerberosMethods); + + d = PyModule_GetDict(m); + + /* create the base exception class */ + if (!(KrbException_class = PyErr_NewException("kerberos.KrbError", NULL, NULL))) + goto error; + PyDict_SetItemString(d, "KrbError", KrbException_class); + Py_INCREF(KrbException_class); + + /* ...and the derived exceptions */ + if (!(BasicAuthException_class = PyErr_NewException("kerberos.BasicAuthError", KrbException_class, NULL))) + goto error; + Py_INCREF(BasicAuthException_class); + PyDict_SetItemString(d, "BasicAuthError", BasicAuthException_class); + + if (!(PwdChangeException_class = PyErr_NewException("kerberos.PwdChangeError", KrbException_class, NULL))) + goto error; + Py_INCREF(PwdChangeException_class); + PyDict_SetItemString(d, "PwdChangeError", PwdChangeException_class); + + if (!(GssException_class = PyErr_NewException("kerberos.GSSError", KrbException_class, NULL))) + goto error; + Py_INCREF(GssException_class); + PyDict_SetItemString(d, "GSSError", GssException_class); + + PyDict_SetItemString(d, "AUTH_GSS_COMPLETE", PyInt_FromLong(AUTH_GSS_COMPLETE)); + PyDict_SetItemString(d, "AUTH_GSS_CONTINUE", PyInt_FromLong(AUTH_GSS_CONTINUE)); + + PyDict_SetItemString(d, "GSS_C_DELEG_FLAG", PyInt_FromLong(GSS_C_DELEG_FLAG)); + PyDict_SetItemString(d, "GSS_C_MUTUAL_FLAG", PyInt_FromLong(GSS_C_MUTUAL_FLAG)); + PyDict_SetItemString(d, "GSS_C_REPLAY_FLAG", PyInt_FromLong(GSS_C_REPLAY_FLAG)); + PyDict_SetItemString(d, "GSS_C_SEQUENCE_FLAG", PyInt_FromLong(GSS_C_SEQUENCE_FLAG)); + PyDict_SetItemString(d, "GSS_C_CONF_FLAG", PyInt_FromLong(GSS_C_CONF_FLAG)); + PyDict_SetItemString(d, "GSS_C_INTEG_FLAG", PyInt_FromLong(GSS_C_INTEG_FLAG)); + PyDict_SetItemString(d, "GSS_C_ANON_FLAG", PyInt_FromLong(GSS_C_ANON_FLAG)); + PyDict_SetItemString(d, "GSS_C_PROT_READY_FLAG", PyInt_FromLong(GSS_C_PROT_READY_FLAG)); + PyDict_SetItemString(d, "GSS_C_TRANS_FLAG", PyInt_FromLong(GSS_C_TRANS_FLAG)); + +error: + if (PyErr_Occurred()) + PyErr_SetString(PyExc_ImportError, "kerberos: init failed"); +} diff --git a/src/kerberosbasic.c b/src/kerberosbasic.c new file mode 100644 index 0000000..0c7bdd7 --- /dev/null +++ b/src/kerberosbasic.c @@ -0,0 +1,151 @@ +/** + * Copyright (c) 2006-2013 Apple Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +#include <Python.h> +#include "kerberosbasic.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#undef PRINTFS + +extern PyObject *BasicAuthException_class; +static void set_basicauth_error(krb5_context context, krb5_error_code code); + +static krb5_error_code verify_krb5_user(krb5_context context, krb5_principal principal, const char *password, krb5_principal server); + +int authenticate_user_krb5pwd(const char *user, const char *pswd, const char *service, const char *default_realm) +{ + krb5_context kcontext = NULL; + krb5_error_code code; + krb5_principal client = NULL; + krb5_principal server = NULL; + int ret = 0; + char *name = NULL; + char *p = NULL; + + code = krb5_init_context(&kcontext); + if (code) + { + PyErr_SetObject(BasicAuthException_class, Py_BuildValue("((s:i))", + "Cannot initialize Kerberos5 context", code)); + return 0; + } + + ret = krb5_parse_name (kcontext, service, &server); + + if (ret) + { + set_basicauth_error(kcontext, ret); + ret = 0; + goto end; + } + + code = krb5_unparse_name(kcontext, server, &name); + if (code) + { + set_basicauth_error(kcontext, code); + ret = 0; + goto end; + } +#ifdef PRINTFS + printf("Using %s as server principal for password verification\n", name); +#endif + free(name); + name = NULL; + + name = (char *)malloc(256); + p = strchr(user, '@'); + if (p == NULL) + { + snprintf(name, 256, "%s@%s", user, default_realm); + } + else + { + snprintf(name, 256, "%s", user); + } + + code = krb5_parse_name(kcontext, name, &client); + if (code) + { + set_basicauth_error(kcontext, code); + ret = 0; + goto end; + } + + code = verify_krb5_user(kcontext, client, pswd, server); + + if (code) + { + ret = 0; + goto end; + } + + ret = 1; + +end: +#ifdef PRINTFS + printf("kerb_authenticate_user_krb5pwd ret=%d user=%s authtype=%s\n", ret, user, "Basic"); +#endif + if (name) + free(name); + if (client) + krb5_free_principal(kcontext, client); + if (server) + krb5_free_principal(kcontext, server); + krb5_free_context(kcontext); + + return ret; +} + +/* Inspired by krb5_verify_user from Heimdal */ +static krb5_error_code verify_krb5_user(krb5_context context, krb5_principal principal, const char *password, krb5_principal server) +{ + krb5_creds creds; + krb5_get_init_creds_opt gic_options; + krb5_error_code ret; + char *name = NULL; + + memset(&creds, 0, sizeof(creds)); + + ret = krb5_unparse_name(context, principal, &name); + if (ret == 0) + { +#ifdef PRINTFS + printf("Trying to get TGT for user %s\n", name); +#endif + free(name); + } + + krb5_get_init_creds_opt_init(&gic_options); + ret = krb5_get_init_creds_password(context, &creds, principal, (char *)password, NULL, NULL, 0, NULL, &gic_options); + if (ret) + { + set_basicauth_error(context, ret); + goto end; + } + +end: + krb5_free_cred_contents(context, &creds); + + return ret; +} + +static void set_basicauth_error(krb5_context context, krb5_error_code code) +{ + PyErr_SetObject(BasicAuthException_class, Py_BuildValue("(s:i)", krb5_get_err_text(context, code), code)); +} diff --git a/src/kerberosbasic.h b/src/kerberosbasic.h new file mode 100644 index 0000000..0a91455 --- /dev/null +++ b/src/kerberosbasic.h @@ -0,0 +1,23 @@ +/** + * Copyright (c) 2006-2013 Apple Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +#include <gssapi/gssapi.h> +#include <gssapi/gssapi_generic.h> +#include <gssapi/gssapi_krb5.h> + +#define krb5_get_err_text(context,code) error_message(code) + +int authenticate_user_krb5pwd(const char *user, const char *pswd, const char *service, const char *default_realm); diff --git a/src/kerberosgss.c b/src/kerberosgss.c new file mode 100644 index 0000000..af8abc1 --- /dev/null +++ b/src/kerberosgss.c @@ -0,0 +1,651 @@ +/** + * Copyright (c) 2006-2013 Apple Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +#include <Python.h> +#include "kerberosgss.h" + +#include "base64.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <arpa/inet.h> + +static void set_gss_error(OM_uint32 err_maj, OM_uint32 err_min); + +extern PyObject *GssException_class; +extern PyObject *KrbException_class; + +char* server_principal_details(const char* service, const char* hostname) +{ + char match[1024]; + size_t match_len = 0; + char* result = NULL; + + int code; + krb5_context kcontext; + krb5_keytab kt = NULL; + krb5_kt_cursor cursor = NULL; + krb5_keytab_entry entry; + char* pname = NULL; + + // Generate the principal prefix we want to match + snprintf(match, 1024, "%s/%s@", service, hostname); + match_len = strlen(match); + + code = krb5_init_context(&kcontext); + if (code) + { + PyErr_SetObject(KrbException_class, Py_BuildValue("((s:i))", + "Cannot initialize Kerberos5 context", code)); + return NULL; + } + + if ((code = krb5_kt_default(kcontext, &kt))) + { + PyErr_SetObject(KrbException_class, Py_BuildValue("((s:i))", + "Cannot get default keytab", code)); + goto end; + } + + if ((code = krb5_kt_start_seq_get(kcontext, kt, &cursor))) + { + PyErr_SetObject(KrbException_class, Py_BuildValue("((s:i))", + "Cannot get sequence cursor from keytab", code)); + goto end; + } + + while ((code = krb5_kt_next_entry(kcontext, kt, &entry, &cursor)) == 0) + { + if ((code = krb5_unparse_name(kcontext, entry.principal, &pname))) + { + PyErr_SetObject(KrbException_class, Py_BuildValue("((s:i))", + "Cannot parse principal name from keytab", code)); + goto end; + } + + if (strncmp(pname, match, match_len) == 0) + { + result = malloc(strlen(pname) + 1); + strcpy(result, pname); + krb5_free_unparsed_name(kcontext, pname); + krb5_free_keytab_entry_contents(kcontext, &entry); + break; + } + + krb5_free_unparsed_name(kcontext, pname); + krb5_free_keytab_entry_contents(kcontext, &entry); + } + + if (result == NULL) + { + PyErr_SetObject(KrbException_class, Py_BuildValue("((s:i))", + "Principal not found in keytab", -1)); + } + +end: + if (cursor) + krb5_kt_end_seq_get(kcontext, kt, &cursor); + if (kt) + krb5_kt_close(kcontext, kt); + krb5_free_context(kcontext); + + return result; +} + +int authenticate_gss_client_init(const char* service, const char* principal, long int gss_flags, gss_client_state* state) +{ + OM_uint32 maj_stat; + OM_uint32 min_stat; + gss_buffer_desc name_token = GSS_C_EMPTY_BUFFER; + gss_buffer_desc principal_token = GSS_C_EMPTY_BUFFER; + int ret = AUTH_GSS_COMPLETE; + + state->server_name = GSS_C_NO_NAME; + state->context = GSS_C_NO_CONTEXT; + state->gss_flags = gss_flags; + state->client_creds = GSS_C_NO_CREDENTIAL; + state->username = NULL; + state->response = NULL; + + // Import server name first + name_token.length = strlen(service); + name_token.value = (char *)service; + + maj_stat = gss_import_name(&min_stat, &name_token, gss_krb5_nt_service_name, &state->server_name); + + if (GSS_ERROR(maj_stat)) + { + set_gss_error(maj_stat, min_stat); + ret = AUTH_GSS_ERROR; + goto end; + } + + // Get credential for principal + if (principal && *principal) + { + gss_name_t name; + principal_token.length = strlen(principal); + principal_token.value = (char *)principal; + + maj_stat = gss_import_name(&min_stat, &principal_token, GSS_C_NT_USER_NAME, &name); + if (GSS_ERROR(maj_stat)) + { + set_gss_error(maj_stat, min_stat); + ret = AUTH_GSS_ERROR; + goto end; + } + + maj_stat = gss_acquire_cred(&min_stat, name, GSS_C_INDEFINITE, GSS_C_NO_OID_SET, GSS_C_INITIATE, + &state->client_creds, NULL, NULL); + if (GSS_ERROR(maj_stat)) + { + set_gss_error(maj_stat, min_stat); + ret = AUTH_GSS_ERROR; + goto end; + } + + maj_stat = gss_release_name(&min_stat, &name); + if (GSS_ERROR(maj_stat)) + { + set_gss_error(maj_stat, min_stat); + ret = AUTH_GSS_ERROR; + goto end; + } + + } + +end: + return ret; +} + +int authenticate_gss_client_clean(gss_client_state *state) +{ + OM_uint32 maj_stat; + OM_uint32 min_stat; + int ret = AUTH_GSS_COMPLETE; + + if (state->context != GSS_C_NO_CONTEXT) + maj_stat = gss_delete_sec_context(&min_stat, &state->context, GSS_C_NO_BUFFER); + if (state->server_name != GSS_C_NO_NAME) + maj_stat = gss_release_name(&min_stat, &state->server_name); + if (state->client_creds != GSS_C_NO_CREDENTIAL) + maj_stat = gss_release_cred(&min_stat, &state->client_creds); + if (state->username != NULL) + { + free(state->username); + state->username = NULL; + } + if (state->response != NULL) + { + free(state->response); + state->response = NULL; + } + + return ret; +} + +int authenticate_gss_client_step(gss_client_state* state, const char* challenge) +{ + OM_uint32 maj_stat; + OM_uint32 min_stat; + gss_buffer_desc input_token = GSS_C_EMPTY_BUFFER; + gss_buffer_desc output_token = GSS_C_EMPTY_BUFFER; + int ret = AUTH_GSS_CONTINUE; + + // Always clear out the old response + if (state->response != NULL) + { + free(state->response); + state->response = NULL; + } + + // If there is a challenge (data from the server) we need to give it to GSS + if (challenge && *challenge) + { + size_t len; + input_token.value = base64_decode(challenge, &len); + input_token.length = len; + } + + // Do GSSAPI step + Py_BEGIN_ALLOW_THREADS + maj_stat = gss_init_sec_context(&min_stat, + state->client_creds, + &state->context, + state->server_name, + GSS_C_NO_OID, + (OM_uint32)state->gss_flags, + 0, + GSS_C_NO_CHANNEL_BINDINGS, + &input_token, + NULL, + &output_token, + NULL, + NULL); + Py_END_ALLOW_THREADS + + if ((maj_stat != GSS_S_COMPLETE) && (maj_stat != GSS_S_CONTINUE_NEEDED)) + { + set_gss_error(maj_stat, min_stat); + ret = AUTH_GSS_ERROR; + goto end; + } + + ret = (maj_stat == GSS_S_COMPLETE) ? AUTH_GSS_COMPLETE : AUTH_GSS_CONTINUE; + // Grab the client response to send back to the server + if (output_token.length) + { + state->response = base64_encode((const unsigned char *)output_token.value, output_token.length);; + maj_stat = gss_release_buffer(&min_stat, &output_token); + } + + // Try to get the user name if we have completed all GSS operations + if (ret == AUTH_GSS_COMPLETE) + { + gss_name_t gssuser = GSS_C_NO_NAME; + maj_stat = gss_inquire_context(&min_stat, state->context, &gssuser, NULL, NULL, NULL, NULL, NULL, NULL); + if (GSS_ERROR(maj_stat)) + { + set_gss_error(maj_stat, min_stat); + ret = AUTH_GSS_ERROR; + goto end; + } + + gss_buffer_desc name_token; + name_token.length = 0; + maj_stat = gss_display_name(&min_stat, gssuser, &name_token, NULL); + if (GSS_ERROR(maj_stat)) + { + if (name_token.value) + gss_release_buffer(&min_stat, &name_token); + gss_release_name(&min_stat, &gssuser); + + set_gss_error(maj_stat, min_stat); + ret = AUTH_GSS_ERROR; + goto end; + } + else + { + state->username = (char *)malloc(name_token.length + 1); + strncpy(state->username, (char*) name_token.value, name_token.length); + state->username[name_token.length] = 0; + gss_release_buffer(&min_stat, &name_token); + gss_release_name(&min_stat, &gssuser); + } + } +end: + if (output_token.value) + gss_release_buffer(&min_stat, &output_token); + if (input_token.value) + free(input_token.value); + return ret; +} + +int authenticate_gss_client_unwrap(gss_client_state *state, const char *challenge) +{ + OM_uint32 maj_stat; + OM_uint32 min_stat; + gss_buffer_desc input_token = GSS_C_EMPTY_BUFFER; + gss_buffer_desc output_token = GSS_C_EMPTY_BUFFER; + int ret = AUTH_GSS_CONTINUE; + + // Always clear out the old response + if (state->response != NULL) + { + free(state->response); + state->response = NULL; + } + + // If there is a challenge (data from the server) we need to give it to GSS + if (challenge && *challenge) + { + size_t len; + input_token.value = base64_decode(challenge, &len); + input_token.length = len; + } + + // Do GSSAPI step + maj_stat = gss_unwrap(&min_stat, + state->context, + &input_token, + &output_token, + NULL, + NULL); + + if (maj_stat != GSS_S_COMPLETE) + { + set_gss_error(maj_stat, min_stat); + ret = AUTH_GSS_ERROR; + goto end; + } + else + ret = AUTH_GSS_COMPLETE; + + // Grab the client response + if (output_token.length) + { + state->response = base64_encode((const unsigned char *)output_token.value, output_token.length); + maj_stat = gss_release_buffer(&min_stat, &output_token); + } +end: + if (output_token.value) + gss_release_buffer(&min_stat, &output_token); + if (input_token.value) + free(input_token.value); + return ret; +} + +int authenticate_gss_client_wrap(gss_client_state* state, const char* challenge, const char* user) +{ + OM_uint32 maj_stat; + OM_uint32 min_stat; + gss_buffer_desc input_token = GSS_C_EMPTY_BUFFER; + gss_buffer_desc output_token = GSS_C_EMPTY_BUFFER; + int ret = AUTH_GSS_CONTINUE; + char buf[4096], server_conf_flags; + unsigned long buf_size; + + // Always clear out the old response + if (state->response != NULL) + { + free(state->response); + state->response = NULL; + } + + if (challenge && *challenge) + { + size_t len; + input_token.value = base64_decode(challenge, &len); + input_token.length = len; + } + + if (user) { + // get bufsize + server_conf_flags = ((char*) input_token.value)[0]; + ((char*) input_token.value)[0] = 0; + buf_size = ntohl(*((long *) input_token.value)); + free(input_token.value); +#ifdef PRINTFS + printf("User: %s, %c%c%c\n", user, + server_conf_flags & GSS_AUTH_P_NONE ? 'N' : '-', + server_conf_flags & GSS_AUTH_P_INTEGRITY ? 'I' : '-', + server_conf_flags & GSS_AUTH_P_PRIVACY ? 'P' : '-'); + printf("Maximum GSS token size is %ld\n", buf_size); +#endif + + // agree to terms (hack!) + buf_size = htonl(buf_size); // not relevant without integrity/privacy + memcpy(buf, &buf_size, 4); + buf[0] = GSS_AUTH_P_NONE; + // server decides if principal can log in as user + strncpy(buf + 4, user, sizeof(buf) - 4); + input_token.value = buf; + input_token.length = 4 + strlen(user); + } + + // Do GSSAPI wrap + maj_stat = gss_wrap(&min_stat, + state->context, + 0, + GSS_C_QOP_DEFAULT, + &input_token, + NULL, + &output_token); + + if (maj_stat != GSS_S_COMPLETE) + { + set_gss_error(maj_stat, min_stat); + ret = AUTH_GSS_ERROR; + goto end; + } + else + ret = AUTH_GSS_COMPLETE; + // Grab the client response to send back to the server + if (output_token.length) + { + state->response = base64_encode((const unsigned char *)output_token.value, output_token.length);; + maj_stat = gss_release_buffer(&min_stat, &output_token); + } +end: + if (output_token.value) + gss_release_buffer(&min_stat, &output_token); + return ret; +} + +int authenticate_gss_server_init(const char *service, gss_server_state *state) +{ + OM_uint32 maj_stat; + OM_uint32 min_stat; + gss_buffer_desc name_token = GSS_C_EMPTY_BUFFER; + int ret = AUTH_GSS_COMPLETE; + + state->context = GSS_C_NO_CONTEXT; + state->server_name = GSS_C_NO_NAME; + state->client_name = GSS_C_NO_NAME; + state->server_creds = GSS_C_NO_CREDENTIAL; + state->client_creds = GSS_C_NO_CREDENTIAL; + state->username = NULL; + state->targetname = NULL; + state->response = NULL; + + // Server name may be empty which means we aren't going to create our own creds + size_t service_len = strlen(service); + if (service_len != 0) + { + // Import server name first + name_token.length = strlen(service); + name_token.value = (char *)service; + + maj_stat = gss_import_name(&min_stat, &name_token, GSS_C_NT_HOSTBASED_SERVICE, &state->server_name); + + if (GSS_ERROR(maj_stat)) + { + set_gss_error(maj_stat, min_stat); + ret = AUTH_GSS_ERROR; + goto end; + } + + // Get credentials + maj_stat = gss_acquire_cred(&min_stat, state->server_name, GSS_C_INDEFINITE, + GSS_C_NO_OID_SET, GSS_C_ACCEPT, &state->server_creds, NULL, NULL); + + if (GSS_ERROR(maj_stat)) + { + set_gss_error(maj_stat, min_stat); + ret = AUTH_GSS_ERROR; + goto end; + } + } + +end: + return ret; +} + +int authenticate_gss_server_clean(gss_server_state *state) +{ + OM_uint32 maj_stat; + OM_uint32 min_stat; + int ret = AUTH_GSS_COMPLETE; + + if (state->context != GSS_C_NO_CONTEXT) + maj_stat = gss_delete_sec_context(&min_stat, &state->context, GSS_C_NO_BUFFER); + if (state->server_name != GSS_C_NO_NAME) + maj_stat = gss_release_name(&min_stat, &state->server_name); + if (state->client_name != GSS_C_NO_NAME) + maj_stat = gss_release_name(&min_stat, &state->client_name); + if (state->server_creds != GSS_C_NO_CREDENTIAL) + maj_stat = gss_release_cred(&min_stat, &state->server_creds); + if (state->client_creds != GSS_C_NO_CREDENTIAL) + maj_stat = gss_release_cred(&min_stat, &state->client_creds); + if (state->username != NULL) + { + free(state->username); + state->username = NULL; + } + if (state->targetname != NULL) + { + free(state->targetname); + state->targetname = NULL; + } + if (state->response != NULL) + { + free(state->response); + state->response = NULL; + } + + return ret; +} + +int authenticate_gss_server_step(gss_server_state *state, const char *challenge) +{ + OM_uint32 maj_stat; + OM_uint32 min_stat; + gss_buffer_desc input_token = GSS_C_EMPTY_BUFFER; + gss_buffer_desc output_token = GSS_C_EMPTY_BUFFER; + int ret = AUTH_GSS_CONTINUE; + + // Always clear out the old response + if (state->response != NULL) + { + free(state->response); + state->response = NULL; + } + + // If there is a challenge (data from the server) we need to give it to GSS + if (challenge && *challenge) + { + size_t len; + input_token.value = base64_decode(challenge, &len); + input_token.length = len; + } + else + { + PyErr_SetString(KrbException_class, "No challenge parameter in request from client"); + ret = AUTH_GSS_ERROR; + goto end; + } + + Py_BEGIN_ALLOW_THREADS + maj_stat = gss_accept_sec_context(&min_stat, + &state->context, + state->server_creds, + &input_token, + GSS_C_NO_CHANNEL_BINDINGS, + &state->client_name, + NULL, + &output_token, + NULL, + NULL, + &state->client_creds); + Py_END_ALLOW_THREADS + + if (GSS_ERROR(maj_stat)) + { + set_gss_error(maj_stat, min_stat); + ret = AUTH_GSS_ERROR; + goto end; + } + + // Grab the server response to send back to the client + if (output_token.length) + { + state->response = base64_encode((const unsigned char *)output_token.value, output_token.length);; + maj_stat = gss_release_buffer(&min_stat, &output_token); + } + + // Get the user name + maj_stat = gss_display_name(&min_stat, state->client_name, &output_token, NULL); + if (GSS_ERROR(maj_stat)) + { + set_gss_error(maj_stat, min_stat); + ret = AUTH_GSS_ERROR; + goto end; + } + state->username = (char *)malloc(output_token.length + 1); + strncpy(state->username, (char*) output_token.value, output_token.length); + state->username[output_token.length] = 0; + + // Get the target name if no server creds were supplied + if (state->server_creds == GSS_C_NO_CREDENTIAL) + { + gss_name_t target_name = GSS_C_NO_NAME; + maj_stat = gss_inquire_context(&min_stat, state->context, NULL, &target_name, NULL, NULL, NULL, NULL, NULL); + if (GSS_ERROR(maj_stat)) + { + set_gss_error(maj_stat, min_stat); + ret = AUTH_GSS_ERROR; + goto end; + } + maj_stat = gss_display_name(&min_stat, target_name, &output_token, NULL); + if (GSS_ERROR(maj_stat)) + { + set_gss_error(maj_stat, min_stat); + ret = AUTH_GSS_ERROR; + goto end; + } + state->targetname = (char *)malloc(output_token.length + 1); + strncpy(state->targetname, (char*) output_token.value, output_token.length); + state->targetname[output_token.length] = 0; + } + + ret = AUTH_GSS_COMPLETE; + +end: + if (output_token.length) + gss_release_buffer(&min_stat, &output_token); + if (input_token.value) + free(input_token.value); + return ret; +} + + +static void set_gss_error(OM_uint32 err_maj, OM_uint32 err_min) +{ + OM_uint32 maj_stat, min_stat; + OM_uint32 msg_ctx = 0; + gss_buffer_desc status_string; + char buf_maj[512]; + char buf_min[512]; + + do + { + maj_stat = gss_display_status (&min_stat, + err_maj, + GSS_C_GSS_CODE, + GSS_C_NO_OID, + &msg_ctx, + &status_string); + if (GSS_ERROR(maj_stat)) + break; + strncpy(buf_maj, (char*) status_string.value, sizeof(buf_maj)); + gss_release_buffer(&min_stat, &status_string); + + maj_stat = gss_display_status (&min_stat, + err_min, + GSS_C_MECH_CODE, + GSS_C_NULL_OID, + &msg_ctx, + &status_string); + if (!GSS_ERROR(maj_stat)) + { + strncpy(buf_min, (char*) status_string.value, sizeof(buf_min)); + gss_release_buffer(&min_stat, &status_string); + } + } while (!GSS_ERROR(maj_stat) && msg_ctx != 0); + + PyErr_SetObject(GssException_class, Py_BuildValue("((s:i)(s:i))", buf_maj, err_maj, buf_min, err_min)); +} diff --git a/src/kerberosgss.h b/src/kerberosgss.h new file mode 100644 index 0000000..7d1f6e3 --- /dev/null +++ b/src/kerberosgss.h @@ -0,0 +1,61 @@ +/** + * Copyright (c) 2006-2013 Apple Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +#include <gssapi/gssapi.h> +#include <gssapi/gssapi_generic.h> +#include <gssapi/gssapi_krb5.h> + +#define krb5_get_err_text(context,code) error_message(code) + +#define AUTH_GSS_ERROR -1 +#define AUTH_GSS_COMPLETE 1 +#define AUTH_GSS_CONTINUE 0 + +#define GSS_AUTH_P_NONE 1 +#define GSS_AUTH_P_INTEGRITY 2 +#define GSS_AUTH_P_PRIVACY 4 + +typedef struct { + gss_ctx_id_t context; + gss_name_t server_name; + long int gss_flags; + gss_cred_id_t client_creds; + char* username; + char* response; +} gss_client_state; + +typedef struct { + gss_ctx_id_t context; + gss_name_t server_name; + gss_name_t client_name; + gss_cred_id_t server_creds; + gss_cred_id_t client_creds; + char* username; + char* targetname; + char* response; +} gss_server_state; + +char* server_principal_details(const char* service, const char* hostname); + +int authenticate_gss_client_init(const char* service, const char* principal, long int gss_flags, gss_client_state* state); +int authenticate_gss_client_clean(gss_client_state *state); +int authenticate_gss_client_step(gss_client_state *state, const char *challenge); +int authenticate_gss_client_unwrap(gss_client_state* state, const char* challenge); +int authenticate_gss_client_wrap(gss_client_state* state, const char* challenge, const char* user); + +int authenticate_gss_server_init(const char* service, gss_server_state* state); +int authenticate_gss_server_clean(gss_server_state *state); +int authenticate_gss_server_step(gss_server_state *state, const char *challenge); diff --git a/src/kerberospw.c b/src/kerberospw.c new file mode 100644 index 0000000..47cf93e --- /dev/null +++ b/src/kerberospw.c @@ -0,0 +1,137 @@ +/** + * Copyright (c) 2008 Guido Guenther <[email protected]> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +#include <Python.h> +#include "kerberospw.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#undef PRINTFS + +extern PyObject *PwdChangeException_class; + +static void set_pwchange_error(krb5_context context, krb5_error_code code) +{ + PyErr_SetObject(PwdChangeException_class, Py_BuildValue("(s:i)", + krb5_get_err_text(context, code), code)); +} + +/* Inspired by krb5_verify_user from Heimdal */ +static krb5_error_code verify_krb5_user(krb5_context context, + krb5_principal principal, + const char *password, + const char *service, + krb5_creds* creds) +{ + krb5_get_init_creds_opt gic_options; + krb5_error_code code; + int ret = 0; + +#ifdef PRINTFS + { + char *name = NULL; + code = krb5_unparse_name(context, principal, &name); + if (!code) + printf("Trying to get TGT for user %s\n", name); + free(name); + } +#endif + krb5_get_init_creds_opt_init(&gic_options); + krb5_get_init_creds_opt_set_forwardable(&gic_options, 0); + krb5_get_init_creds_opt_set_proxiable(&gic_options, 0); + krb5_get_init_creds_opt_set_renew_life(&gic_options, 0); + + memset(creds, 0, sizeof(krb5_creds)); + + code = krb5_get_init_creds_password(context, creds, principal, + (char *)password, NULL, NULL, 0, + (char *)service, &gic_options); + if (code) { + set_pwchange_error(context, code); + goto end; + } + ret = 1; /* success */ +end: + return ret; +} + +int change_user_krb5pwd(const char *user, const char* oldpswd, const char *newpswd) +{ + krb5_context kcontext = NULL; + krb5_error_code code; + krb5_principal client = NULL; + krb5_creds creds; + int ret = 0; + char *name = NULL; + const char* service = "kadmin/changepw"; + int result_code; + krb5_data result_code_string, result_string; + + code = krb5_init_context(&kcontext); + if (code) { + PyErr_SetObject(PwdChangeException_class, Py_BuildValue("((s:i))", + "Cannot initialize Kerberos5 context", + code)); + return 0; + } + + name = (char *)malloc(256); + snprintf(name, 256, "%s", user); + + code = krb5_parse_name(kcontext, name, &client); + if (code) { + set_pwchange_error(kcontext, code); + goto end; + } + + code = verify_krb5_user(kcontext, client, oldpswd, service, &creds); + if (!code) /* exception set by verify_krb5_user */ + goto end; + + code = krb5_change_password(kcontext, &creds, (char*)newpswd, + &result_code, &result_code_string, &result_string); + if (code) { + set_pwchange_error(kcontext, code); + goto end; + } + if (result_code) { + char *message = NULL; + asprintf(&message, "%.*s: %.*s", + (int) result_code_string.length, + (char *) result_code_string.data, + (int) result_string.length, + (char *) result_string.data); + PyErr_SetObject(PwdChangeException_class, Py_BuildValue("((s:i))", + message, result_code)); + free(message); + goto end; + } + + ret = 1; /* success */ +end: +#ifdef PRINTFS + printf("%s: ret=%d user=%s\n", __FUNCTION__, ret, name); +#endif + if (name) + free(name); + if (client) + krb5_free_principal(kcontext, client); + krb5_free_context(kcontext); + return ret; +} + diff --git a/src/kerberospw.h b/src/kerberospw.h new file mode 100644 index 0000000..578108a --- /dev/null +++ b/src/kerberospw.h @@ -0,0 +1,24 @@ +/** + * Copyright (c) 2008 Guido Guenther <[email protected]> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + **/ + +#include <gssapi/gssapi.h> +#include <gssapi/gssapi_generic.h> +#include <gssapi/gssapi_krb5.h> + +#define krb5_get_err_text(context,code) error_message(code) + +int change_user_krb5pwd(const char *user, const char* oldpswd, const char *newpswd); diff --git a/support/.svn/all-wcprops b/support/.svn/all-wcprops new file mode 100644 index 0000000..b88809d --- /dev/null +++ b/support/.svn/all-wcprops @@ -0,0 +1,11 @@ +K 25 +svn:wc:ra_dav:version-url +V 66 +/repository/calendarserver/!svn/ver/10302/PyKerberos/trunk/support +END +main.c +K 25 +svn:wc:ra_dav:version-url +V 73 +/repository/calendarserver/!svn/ver/10302/PyKerberos/trunk/support/main.c +END diff --git a/support/.svn/dir-prop-base b/support/.svn/dir-prop-base new file mode 100644 index 0000000..bd19930 --- /dev/null +++ b/support/.svn/dir-prop-base @@ -0,0 +1,6 @@ +K 10 +svn:ignore +V 6 +build + +END diff --git a/support/.svn/entries b/support/.svn/entries new file mode 100644 index 0000000..0a94cbb --- /dev/null +++ b/support/.svn/entries @@ -0,0 +1,65 @@ +10 + +dir +10603 +http://svn.calendarserver.org/repository/calendarserver/PyKerberos/trunk/support +http://svn.calendarserver.org/repository/calendarserver + + + +2013-01-15T00:00:30.229472Z +10302 [email protected] +has-props + + + + + + + + + + + + + +e27351fd-9f3e-4f54-a53b-843176b1656c + +PyKerberos.xcodeproj +dir + +main.c +file + + + + +2013-01-30T21:54:22.000000Z +cbc52f27454f147623de981e075d7a95 +2013-01-15T00:00:30.229472Z +10302 [email protected] + + + + + + + + + + + + + + + + + + + + + +1131 + diff --git a/support/.svn/text-base/main.c.svn-base b/support/.svn/text-base/main.c.svn-base new file mode 100644 index 0000000..f6e7b07 --- /dev/null +++ b/support/.svn/text-base/main.c.svn-base @@ -0,0 +1,37 @@ +/** + * Copyright (c) 2006-2013 Apple Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +#include "kerberosgss.h" + +#include "stdio.h" + +int main (int argc, char * const argv[]) { + + int code = 0; + char* service = 0L; + gss_server_state state; + + service = server_principal_details("http", "caldav.local"); + + //printf("Got service principal: %s\n", result); + + //code = authenticate_user_krb5pwd("x", "x", "http/[email protected]", "CALDAV.CORP.APPLE.COM"); + + code = authenticate_gss_server_init("", &state); + code = authenticate_gss_server_clean(&state); + + return 0; +} diff --git a/support/PyKerberos.xcodeproj/.svn/all-wcprops b/support/PyKerberos.xcodeproj/.svn/all-wcprops new file mode 100644 index 0000000..c5ac1af --- /dev/null +++ b/support/PyKerberos.xcodeproj/.svn/all-wcprops @@ -0,0 +1,23 @@ +K 25 +svn:wc:ra_dav:version-url +V 86 +/repository/calendarserver/!svn/ver/4241/PyKerberos/trunk/support/PyKerberos.xcodeproj +END +cyrusdaboo.pbxuser +K 25 +svn:wc:ra_dav:version-url +V 105 +/repository/calendarserver/!svn/ver/4241/PyKerberos/trunk/support/PyKerberos.xcodeproj/cyrusdaboo.pbxuser +END +cyrusdaboo.mode1v3 +K 25 +svn:wc:ra_dav:version-url +V 105 +/repository/calendarserver/!svn/ver/4241/PyKerberos/trunk/support/PyKerberos.xcodeproj/cyrusdaboo.mode1v3 +END +project.pbxproj +K 25 +svn:wc:ra_dav:version-url +V 102 +/repository/calendarserver/!svn/ver/4241/PyKerberos/trunk/support/PyKerberos.xcodeproj/project.pbxproj +END diff --git a/support/PyKerberos.xcodeproj/.svn/entries b/support/PyKerberos.xcodeproj/.svn/entries new file mode 100644 index 0000000..a044e5b --- /dev/null +++ b/support/PyKerberos.xcodeproj/.svn/entries @@ -0,0 +1,130 @@ +10 + +dir +10603 +http://svn.calendarserver.org/repository/calendarserver/PyKerberos/trunk/support/PyKerberos.xcodeproj +http://svn.calendarserver.org/repository/calendarserver + + + +2009-05-13T01:01:58.324992Z +4241 [email protected] + + + + + + + + + + + + + + +e27351fd-9f3e-4f54-a53b-843176b1656c + +cyrusdaboo.pbxuser +file + + + + +2013-01-30T21:54:22.000000Z +b247a2e34c34ab56f851ef5299379e90 +2009-05-13T01:01:58.324992Z +4241 [email protected] + + + + + + + + + + + + + + + + + + + + + +20973 + +cyrusdaboo.mode1v3 +file + + + + +2013-01-30T21:54:22.000000Z +28d1b85e22db75d3c1bc3db741cd6197 +2009-05-13T01:01:58.324992Z +4241 [email protected] + + + + + + + + + + + + + + + + + + + + + +40810 + +project.pbxproj +file + + + + +2013-01-30T21:54:22.000000Z +cb33208243f9eea105b49902c500545a +2009-05-13T01:01:58.324992Z +4241 [email protected] + + + + + + + + + + + + + + + + + + + + + +10959 + diff --git a/support/PyKerberos.xcodeproj/.svn/text-base/cyrusdaboo.mode1v3.svn-base b/support/PyKerberos.xcodeproj/.svn/text-base/cyrusdaboo.mode1v3.svn-base new file mode 100644 index 0000000..a46d695 --- /dev/null +++ b/support/PyKerberos.xcodeproj/.svn/text-base/cyrusdaboo.mode1v3.svn-base @@ -0,0 +1,1409 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>ActivePerspectiveName</key> + <string>Project</string> + <key>AllowedModules</key> + <array> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>n</string> + <key>Module</key> + <string>PBXSmartGroupTreeModule</string> + <key>Name</key> + <string>Groups and Files Outline View</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>n</string> + <key>Module</key> + <string>PBXNavigatorGroup</string> + <key>Name</key> + <string>Editor</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>n</string> + <key>Module</key> + <string>XCTaskListModule</string> + <key>Name</key> + <string>Task List</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>n</string> + <key>Module</key> + <string>XCDetailModule</string> + <key>Name</key> + <string>File and Smart Group Detail Viewer</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>1</string> + <key>Module</key> + <string>PBXBuildResultsModule</string> + <key>Name</key> + <string>Detailed Build Results Viewer</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>1</string> + <key>Module</key> + <string>PBXProjectFindModule</string> + <key>Name</key> + <string>Project Batch Find Tool</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>n</string> + <key>Module</key> + <string>XCProjectFormatConflictsModule</string> + <key>Name</key> + <string>Project Format Conflicts List</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>n</string> + <key>Module</key> + <string>PBXBookmarksModule</string> + <key>Name</key> + <string>Bookmarks Tool</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>n</string> + <key>Module</key> + <string>PBXClassBrowserModule</string> + <key>Name</key> + <string>Class Browser</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>n</string> + <key>Module</key> + <string>PBXCVSModule</string> + <key>Name</key> + <string>Source Code Control Tool</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>n</string> + <key>Module</key> + <string>PBXDebugBreakpointsModule</string> + <key>Name</key> + <string>Debug Breakpoints Tool</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>n</string> + <key>Module</key> + <string>XCDockableInspector</string> + <key>Name</key> + <string>Inspector</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>n</string> + <key>Module</key> + <string>PBXOpenQuicklyModule</string> + <key>Name</key> + <string>Open Quickly Tool</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>1</string> + <key>Module</key> + <string>PBXDebugSessionModule</string> + <key>Name</key> + <string>Debugger</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>1</string> + <key>Module</key> + <string>PBXDebugCLIModule</string> + <key>Name</key> + <string>Debug Console</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>n</string> + <key>Module</key> + <string>XCSnapshotModule</string> + <key>Name</key> + <string>Snapshots Tool</string> + </dict> + </array> + <key>BundlePath</key> + <string>/Developer/Library/PrivateFrameworks/DevToolsInterface.framework/Resources</string> + <key>Description</key> + <string>DefaultDescriptionKey</string> + <key>DockingSystemVisible</key> + <false/> + <key>Extension</key> + <string>mode1v3</string> + <key>FavBarConfig</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>AF88E9340FBA3EB400C5AA9C</string> + <key>XCBarModuleItemNames</key> + <dict/> + <key>XCBarModuleItems</key> + <array/> + </dict> + <key>FirstTimeWindowDisplayed</key> + <false/> + <key>Identifier</key> + <string>com.apple.perspectives.project.mode1v3</string> + <key>MajorVersion</key> + <integer>33</integer> + <key>MinorVersion</key> + <integer>0</integer> + <key>Name</key> + <string>Default</string> + <key>Notifications</key> + <array/> + <key>OpenEditors</key> + <array/> + <key>PerspectiveWidths</key> + <array> + <integer>-1</integer> + <integer>-1</integer> + </array> + <key>Perspectives</key> + <array> + <dict> + <key>ChosenToolbarItems</key> + <array> + <string>active-combo-popup</string> + <string>action</string> + <string>NSToolbarFlexibleSpaceItem</string> + <string>buildOrClean</string> + <string>build-and-go</string> + <string>go</string> + <string>servicesModulebuild</string> + <string>debugger-enable-breakpoints</string> + <string>com.apple.ide.PBXToolbarStopButton</string> + <string>toggle-editor</string> + <string>get-info</string> + <string>NSToolbarFlexibleSpaceItem</string> + <string>com.apple.pbx.toolbar.searchfield</string> + </array> + <key>ControllerClassBaseName</key> + <string></string> + <key>IconName</key> + <string>WindowOfProjectWithEditor</string> + <key>Identifier</key> + <string>perspective.project</string> + <key>IsVertical</key> + <false/> + <key>Layout</key> + <array> + <dict> + <key>ContentConfiguration</key> + <dict> + <key>PBXBottomSmartGroupGIDs</key> + <array> + <string>1C37FBAC04509CD000000102</string> + <string>1C37FAAC04509CD000000102</string> + <string>1C37FABC05509CD000000102</string> + <string>1C37FABC05539CD112110102</string> + <string>E2644B35053B69B200211256</string> + <string>1C37FABC04509CD000100104</string> + <string>1CC0EA4004350EF90044410B</string> + <string>1CC0EA4004350EF90041110B</string> + </array> + <key>PBXProjectModuleGUID</key> + <string>1CE0B1FE06471DED0097A5F4</string> + <key>PBXProjectModuleLabel</key> + <string>Files</string> + <key>PBXProjectStructureProvided</key> + <string>yes</string> + <key>PBXSmartGroupTreeModuleColumnData</key> + <dict> + <key>PBXSmartGroupTreeModuleColumnWidthsKey</key> + <array> + <real>275</real> + </array> + <key>PBXSmartGroupTreeModuleColumnsKey_v4</key> + <array> + <string>MainColumn</string> + </array> + </dict> + <key>PBXSmartGroupTreeModuleOutlineStateKey_v7</key> + <dict> + <key>PBXSmartGroupTreeModuleOutlineStateExpansionKey</key> + <array> + <string>08FB7794FE84155DC02AAC07</string> + <string>08FB7795FE84155DC02AAC07</string> + <string>AFDE38300BB41F71008C037E</string> + <string>1C37FABC05509CD000000102</string> + </array> + <key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key> + <array> + <array> + <integer>7</integer> + <integer>1</integer> + <integer>0</integer> + </array> + </array> + <key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key> + <string>{{0, 0}, {275, 1060}}</string> + </dict> + <key>PBXTopSmartGroupGIDs</key> + <array/> + <key>XCIncludePerspectivesSwitch</key> + <true/> + <key>XCSharingToken</key> + <string>com.apple.Xcode.GFSharingToken</string> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{{0, 0}, {292, 1078}}</string> + <key>GroupTreeTableConfiguration</key> + <array> + <string>MainColumn</string> + <real>275</real> + </array> + <key>RubberWindowFrame</key> + <string>0 59 1920 1119 0 0 1920 1178 </string> + </dict> + <key>Module</key> + <string>PBXSmartGroupTreeModule</string> + <key>Proportion</key> + <string>292pt</string> + </dict> + <dict> + <key>Dock</key> + <array> + <dict> + <key>BecomeActive</key> + <true/> + <key>ContentConfiguration</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>1CE0B20306471E060097A5F4</string> + <key>PBXProjectModuleLabel</key> + <string>kerberosgss.c</string> + <key>PBXSplitModuleInNavigatorKey</key> + <dict> + <key>Split0</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>1CE0B20406471E060097A5F4</string> + <key>PBXProjectModuleLabel</key> + <string>kerberosgss.c</string> + <key>_historyCapacity</key> + <integer>0</integer> + <key>bookmark</key> + <string>AF88E97B0FBA449500C5AA9C</string> + <key>history</key> + <array> + <string>AF88E95D0FBA41D300C5AA9C</string> + <string>AF88E95F0FBA41D300C5AA9C</string> + <string>AF88E9600FBA41D300C5AA9C</string> + <string>AF88E9610FBA41D300C5AA9C</string> + <string>AF88E9660FBA435000C5AA9C</string> + <string>AF88E9670FBA435000C5AA9C</string> + <string>AF88E9680FBA435000C5AA9C</string> + <string>AF88E9690FBA435000C5AA9C</string> + <string>AF88E97A0FBA449500C5AA9C</string> + </array> + </dict> + <key>SplitCount</key> + <string>1</string> + </dict> + <key>StatusBarVisibility</key> + <true/> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{{0, 0}, {1623, 648}}</string> + <key>RubberWindowFrame</key> + <string>0 59 1920 1119 0 0 1920 1178 </string> + </dict> + <key>Module</key> + <string>PBXNavigatorGroup</string> + <key>Proportion</key> + <string>648pt</string> + </dict> + <dict> + <key>ContentConfiguration</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>1CE0B20506471E060097A5F4</string> + <key>PBXProjectModuleLabel</key> + <string>Detail</string> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{{0, 653}, {1623, 425}}</string> + <key>RubberWindowFrame</key> + <string>0 59 1920 1119 0 0 1920 1178 </string> + </dict> + <key>Module</key> + <string>XCDetailModule</string> + <key>Proportion</key> + <string>425pt</string> + </dict> + </array> + <key>Proportion</key> + <string>1623pt</string> + </dict> + </array> + <key>Name</key> + <string>Project</string> + <key>ServiceClasses</key> + <array> + <string>XCModuleDock</string> + <string>PBXSmartGroupTreeModule</string> + <string>XCModuleDock</string> + <string>PBXNavigatorGroup</string> + <string>XCDetailModule</string> + </array> + <key>TableOfContents</key> + <array> + <string>AF88E9320FBA3EB400C5AA9C</string> + <string>1CE0B1FE06471DED0097A5F4</string> + <string>AF88E9330FBA3EB400C5AA9C</string> + <string>1CE0B20306471E060097A5F4</string> + <string>1CE0B20506471E060097A5F4</string> + </array> + <key>ToolbarConfigUserDefaultsMinorVersion</key> + <string>2</string> + <key>ToolbarConfiguration</key> + <string>xcode.toolbar.config.defaultV3</string> + </dict> + <dict> + <key>ControllerClassBaseName</key> + <string></string> + <key>IconName</key> + <string>WindowOfProject</string> + <key>Identifier</key> + <string>perspective.morph</string> + <key>IsVertical</key> + <integer>0</integer> + <key>Layout</key> + <array> + <dict> + <key>BecomeActive</key> + <integer>1</integer> + <key>ContentConfiguration</key> + <dict> + <key>PBXBottomSmartGroupGIDs</key> + <array> + <string>1C37FBAC04509CD000000102</string> + <string>1C37FAAC04509CD000000102</string> + <string>1C08E77C0454961000C914BD</string> + <string>1C37FABC05509CD000000102</string> + <string>1C37FABC05539CD112110102</string> + <string>E2644B35053B69B200211256</string> + <string>1C37FABC04509CD000100104</string> + <string>1CC0EA4004350EF90044410B</string> + <string>1CC0EA4004350EF90041110B</string> + </array> + <key>PBXProjectModuleGUID</key> + <string>11E0B1FE06471DED0097A5F4</string> + <key>PBXProjectModuleLabel</key> + <string>Files</string> + <key>PBXProjectStructureProvided</key> + <string>yes</string> + <key>PBXSmartGroupTreeModuleColumnData</key> + <dict> + <key>PBXSmartGroupTreeModuleColumnWidthsKey</key> + <array> + <real>186</real> + </array> + <key>PBXSmartGroupTreeModuleColumnsKey_v4</key> + <array> + <string>MainColumn</string> + </array> + </dict> + <key>PBXSmartGroupTreeModuleOutlineStateKey_v7</key> + <dict> + <key>PBXSmartGroupTreeModuleOutlineStateExpansionKey</key> + <array> + <string>29B97314FDCFA39411CA2CEA</string> + <string>1C37FABC05509CD000000102</string> + </array> + <key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key> + <array> + <array> + <integer>0</integer> + </array> + </array> + <key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key> + <string>{{0, 0}, {186, 337}}</string> + </dict> + <key>PBXTopSmartGroupGIDs</key> + <array/> + <key>XCIncludePerspectivesSwitch</key> + <integer>1</integer> + <key>XCSharingToken</key> + <string>com.apple.Xcode.GFSharingToken</string> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{{0, 0}, {203, 355}}</string> + <key>GroupTreeTableConfiguration</key> + <array> + <string>MainColumn</string> + <real>186</real> + </array> + <key>RubberWindowFrame</key> + <string>373 269 690 397 0 0 1440 878 </string> + </dict> + <key>Module</key> + <string>PBXSmartGroupTreeModule</string> + <key>Proportion</key> + <string>100%</string> + </dict> + </array> + <key>Name</key> + <string>Morph</string> + <key>PreferredWidth</key> + <integer>300</integer> + <key>ServiceClasses</key> + <array> + <string>XCModuleDock</string> + <string>PBXSmartGroupTreeModule</string> + </array> + <key>TableOfContents</key> + <array> + <string>11E0B1FE06471DED0097A5F4</string> + </array> + <key>ToolbarConfiguration</key> + <string>xcode.toolbar.config.default.shortV3</string> + </dict> + </array> + <key>PerspectivesBarVisible</key> + <false/> + <key>ShelfIsVisible</key> + <false/> + <key>SourceDescription</key> + <string>file at '/Developer/Library/PrivateFrameworks/DevToolsInterface.framework/Resources/XCPerspectivesSpecificationMode1.xcperspec'</string> + <key>StatusbarIsVisible</key> + <true/> + <key>TimeStamp</key> + <real>0.0</real> + <key>ToolbarConfigUserDefaultsMinorVersion</key> + <string>2</string> + <key>ToolbarDisplayMode</key> + <integer>1</integer> + <key>ToolbarIsVisible</key> + <true/> + <key>ToolbarSizeMode</key> + <integer>1</integer> + <key>Type</key> + <string>Perspectives</string> + <key>UpdateMessage</key> + <string>The Default Workspace in this version of Xcode now includes support to hide and show the detail view (what has been referred to as the "Metro-Morph" feature). You must discard your current Default Workspace settings and update to the latest Default Workspace in order to gain this feature. Do you wish to update to the latest Workspace defaults for project '%@'?</string> + <key>WindowJustification</key> + <integer>5</integer> + <key>WindowOrderList</key> + <array> + <string>AF88E9640FBA41D300C5AA9C</string> + <string>AF88E9650FBA41D300C5AA9C</string> + <string>1C78EAAD065D492600B07095</string> + <string>AF88E9420FBA3FD300C5AA9C</string> + <string>1CD10A99069EF8BA00B06720</string> + <string>/Volumes/Data/Users/cyrusdaboo/Documents/Development/Apple/eclipse/PyKerberos/support/PyKerberos.xcodeproj</string> + </array> + <key>WindowString</key> + <string>0 59 1920 1119 0 0 1920 1178 </string> + <key>WindowToolsV3</key> + <array> + <dict> + <key>FirstTimeWindowDisplayed</key> + <false/> + <key>Identifier</key> + <string>windowTool.build</string> + <key>IsVertical</key> + <true/> + <key>Layout</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>ContentConfiguration</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>1CD0528F0623707200166675</string> + <key>PBXProjectModuleLabel</key> + <string>kerberosbasic.c</string> + <key>StatusBarVisibility</key> + <true/> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{{0, 0}, {1344, 622}}</string> + <key>RubberWindowFrame</key> + <string>21 251 1344 904 0 0 1920 1178 </string> + </dict> + <key>Module</key> + <string>PBXNavigatorGroup</string> + <key>Proportion</key> + <string>622pt</string> + </dict> + <dict> + <key>BecomeActive</key> + <true/> + <key>ContentConfiguration</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>XCMainBuildResultsModuleGUID</string> + <key>PBXProjectModuleLabel</key> + <string>Build Results</string> + <key>XCBuildResultsTrigger_Collapse</key> + <integer>1021</integer> + <key>XCBuildResultsTrigger_Open</key> + <integer>1011</integer> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{{0, 627}, {1344, 236}}</string> + <key>RubberWindowFrame</key> + <string>21 251 1344 904 0 0 1920 1178 </string> + </dict> + <key>Module</key> + <string>PBXBuildResultsModule</string> + <key>Proportion</key> + <string>236pt</string> + </dict> + </array> + <key>Proportion</key> + <string>863pt</string> + </dict> + </array> + <key>Name</key> + <string>Build Results</string> + <key>ServiceClasses</key> + <array> + <string>PBXBuildResultsModule</string> + </array> + <key>StatusbarIsVisible</key> + <true/> + <key>TableOfContents</key> + <array> + <string>AF88E9420FBA3FD300C5AA9C</string> + <string>AF88E9430FBA3FD300C5AA9C</string> + <string>1CD0528F0623707200166675</string> + <string>XCMainBuildResultsModuleGUID</string> + </array> + <key>ToolbarConfiguration</key> + <string>xcode.toolbar.config.buildV3</string> + <key>WindowString</key> + <string>21 251 1344 904 0 0 1920 1178 </string> + <key>WindowToolGUID</key> + <string>AF88E9420FBA3FD300C5AA9C</string> + <key>WindowToolIsVisible</key> + <false/> + </dict> + <dict> + <key>FirstTimeWindowDisplayed</key> + <false/> + <key>Identifier</key> + <string>windowTool.debugger</string> + <key>IsVertical</key> + <true/> + <key>Layout</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>ContentConfiguration</key> + <dict> + <key>Debugger</key> + <dict> + <key>HorizontalSplitView</key> + <dict> + <key>_collapsingFrameDimension</key> + <real>0.0</real> + <key>_indexOfCollapsedView</key> + <integer>0</integer> + <key>_percentageOfCollapsedView</key> + <real>0.0</real> + <key>isCollapsed</key> + <string>yes</string> + <key>sizes</key> + <array> + <string>{{0, 0}, {733, 484}}</string> + <string>{{733, 0}, {877, 484}}</string> + </array> + </dict> + <key>VerticalSplitView</key> + <dict> + <key>_collapsingFrameDimension</key> + <real>0.0</real> + <key>_indexOfCollapsedView</key> + <integer>0</integer> + <key>_percentageOfCollapsedView</key> + <real>0.0</real> + <key>isCollapsed</key> + <string>yes</string> + <key>sizes</key> + <array> + <string>{{0, 0}, {1610, 484}}</string> + <string>{{0, 484}, {1610, 512}}</string> + </array> + </dict> + </dict> + <key>LauncherConfigVersion</key> + <string>8</string> + <key>PBXProjectModuleGUID</key> + <string>1C162984064C10D400B95A72</string> + <key>PBXProjectModuleLabel</key> + <string>Debug - GLUTExamples (Underwater)</string> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>DebugConsoleVisible</key> + <string>None</string> + <key>DebugConsoleWindowFrame</key> + <string>{{200, 200}, {500, 300}}</string> + <key>DebugSTDIOWindowFrame</key> + <string>{{200, 200}, {500, 300}}</string> + <key>Frame</key> + <string>{{0, 0}, {1610, 996}}</string> + <key>PBXDebugSessionStackFrameViewKey</key> + <dict> + <key>DebugVariablesTableConfiguration</key> + <array> + <string>Name</string> + <real>120</real> + <string>Value</string> + <real>85</real> + <string>Summary</string> + <real>647</real> + </array> + <key>Frame</key> + <string>{{733, 0}, {877, 484}}</string> + <key>RubberWindowFrame</key> + <string>21 118 1610 1037 0 0 1920 1178 </string> + </dict> + <key>RubberWindowFrame</key> + <string>21 118 1610 1037 0 0 1920 1178 </string> + </dict> + <key>Module</key> + <string>PBXDebugSessionModule</string> + <key>Proportion</key> + <string>996pt</string> + </dict> + </array> + <key>Proportion</key> + <string>996pt</string> + </dict> + </array> + <key>Name</key> + <string>Debugger</string> + <key>ServiceClasses</key> + <array> + <string>PBXDebugSessionModule</string> + </array> + <key>StatusbarIsVisible</key> + <true/> + <key>TableOfContents</key> + <array> + <string>1CD10A99069EF8BA00B06720</string> + <string>AF88E9350FBA3EB400C5AA9C</string> + <string>1C162984064C10D400B95A72</string> + <string>AF88E9360FBA3EB400C5AA9C</string> + <string>AF88E9370FBA3EB400C5AA9C</string> + <string>AF88E9380FBA3EB400C5AA9C</string> + <string>AF88E9390FBA3EB400C5AA9C</string> + <string>AF88E93A0FBA3EB400C5AA9C</string> + </array> + <key>ToolbarConfiguration</key> + <string>xcode.toolbar.config.debugV3</string> + <key>WindowString</key> + <string>21 118 1610 1037 0 0 1920 1178 </string> + <key>WindowToolGUID</key> + <string>1CD10A99069EF8BA00B06720</string> + <key>WindowToolIsVisible</key> + <false/> + </dict> + <dict> + <key>Identifier</key> + <string>windowTool.find</string> + <key>Layout</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>ContentConfiguration</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>1CDD528C0622207200134675</string> + <key>PBXProjectModuleLabel</key> + <string>&lt;No Editor&gt;</string> + <key>PBXSplitModuleInNavigatorKey</key> + <dict> + <key>Split0</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>1CD0528D0623707200166675</string> + </dict> + <key>SplitCount</key> + <string>1</string> + </dict> + <key>StatusBarVisibility</key> + <integer>1</integer> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{{0, 0}, {781, 167}}</string> + <key>RubberWindowFrame</key> + <string>62 385 781 470 0 0 1440 878 </string> + </dict> + <key>Module</key> + <string>PBXNavigatorGroup</string> + <key>Proportion</key> + <string>781pt</string> + </dict> + </array> + <key>Proportion</key> + <string>50%</string> + </dict> + <dict> + <key>BecomeActive</key> + <integer>1</integer> + <key>ContentConfiguration</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>1CD0528E0623707200166675</string> + <key>PBXProjectModuleLabel</key> + <string>Project Find</string> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{{8, 0}, {773, 254}}</string> + <key>RubberWindowFrame</key> + <string>62 385 781 470 0 0 1440 878 </string> + </dict> + <key>Module</key> + <string>PBXProjectFindModule</string> + <key>Proportion</key> + <string>50%</string> + </dict> + </array> + <key>Proportion</key> + <string>428pt</string> + </dict> + </array> + <key>Name</key> + <string>Project Find</string> + <key>ServiceClasses</key> + <array> + <string>PBXProjectFindModule</string> + </array> + <key>StatusbarIsVisible</key> + <integer>1</integer> + <key>TableOfContents</key> + <array> + <string>1C530D57069F1CE1000CFCEE</string> + <string>1C530D58069F1CE1000CFCEE</string> + <string>1C530D59069F1CE1000CFCEE</string> + <string>1CDD528C0622207200134675</string> + <string>1C530D5A069F1CE1000CFCEE</string> + <string>1CE0B1FE06471DED0097A5F4</string> + <string>1CD0528E0623707200166675</string> + </array> + <key>WindowString</key> + <string>62 385 781 470 0 0 1440 878 </string> + <key>WindowToolGUID</key> + <string>1C530D57069F1CE1000CFCEE</string> + <key>WindowToolIsVisible</key> + <integer>0</integer> + </dict> + <dict> + <key>Identifier</key> + <string>MENUSEPARATOR</string> + </dict> + <dict> + <key>FirstTimeWindowDisplayed</key> + <false/> + <key>Identifier</key> + <string>windowTool.debuggerConsole</string> + <key>IsVertical</key> + <true/> + <key>Layout</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>ContentConfiguration</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>1C78EAAC065D492600B07095</string> + <key>PBXProjectModuleLabel</key> + <string>Debugger Console</string> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{{0, 0}, {650, 209}}</string> + <key>RubberWindowFrame</key> + <string>21 905 650 250 0 0 1920 1178 </string> + </dict> + <key>Module</key> + <string>PBXDebugCLIModule</string> + <key>Proportion</key> + <string>209pt</string> + </dict> + </array> + <key>Proportion</key> + <string>209pt</string> + </dict> + </array> + <key>Name</key> + <string>Debugger Console</string> + <key>ServiceClasses</key> + <array> + <string>PBXDebugCLIModule</string> + </array> + <key>StatusbarIsVisible</key> + <true/> + <key>TableOfContents</key> + <array> + <string>1C78EAAD065D492600B07095</string> + <string>AF88E9570FBA419E00C5AA9C</string> + <string>1C78EAAC065D492600B07095</string> + </array> + <key>ToolbarConfiguration</key> + <string>xcode.toolbar.config.consoleV3</string> + <key>WindowString</key> + <string>21 905 650 250 0 0 1920 1178 </string> + <key>WindowToolGUID</key> + <string>1C78EAAD065D492600B07095</string> + <key>WindowToolIsVisible</key> + <false/> + </dict> + <dict> + <key>Identifier</key> + <string>windowTool.snapshots</string> + <key>Layout</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>Module</key> + <string>XCSnapshotModule</string> + <key>Proportion</key> + <string>100%</string> + </dict> + </array> + <key>Proportion</key> + <string>100%</string> + </dict> + </array> + <key>Name</key> + <string>Snapshots</string> + <key>ServiceClasses</key> + <array> + <string>XCSnapshotModule</string> + </array> + <key>StatusbarIsVisible</key> + <string>Yes</string> + <key>ToolbarConfiguration</key> + <string>xcode.toolbar.config.snapshots</string> + <key>WindowString</key> + <string>315 824 300 550 0 0 1440 878 </string> + <key>WindowToolIsVisible</key> + <string>Yes</string> + </dict> + <dict> + <key>Identifier</key> + <string>windowTool.scm</string> + <key>Layout</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>ContentConfiguration</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>1C78EAB2065D492600B07095</string> + <key>PBXProjectModuleLabel</key> + <string>&lt;No Editor&gt;</string> + <key>PBXSplitModuleInNavigatorKey</key> + <dict> + <key>Split0</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>1C78EAB3065D492600B07095</string> + </dict> + <key>SplitCount</key> + <string>1</string> + </dict> + <key>StatusBarVisibility</key> + <integer>1</integer> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{{0, 0}, {452, 0}}</string> + <key>RubberWindowFrame</key> + <string>743 379 452 308 0 0 1280 1002 </string> + </dict> + <key>Module</key> + <string>PBXNavigatorGroup</string> + <key>Proportion</key> + <string>0pt</string> + </dict> + <dict> + <key>BecomeActive</key> + <integer>1</integer> + <key>ContentConfiguration</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>1CD052920623707200166675</string> + <key>PBXProjectModuleLabel</key> + <string>SCM</string> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>ConsoleFrame</key> + <string>{{0, 259}, {452, 0}}</string> + <key>Frame</key> + <string>{{0, 7}, {452, 259}}</string> + <key>RubberWindowFrame</key> + <string>743 379 452 308 0 0 1280 1002 </string> + <key>TableConfiguration</key> + <array> + <string>Status</string> + <real>30</real> + <string>FileName</string> + <real>199</real> + <string>Path</string> + <real>197.0950012207031</real> + </array> + <key>TableFrame</key> + <string>{{0, 0}, {452, 250}}</string> + </dict> + <key>Module</key> + <string>PBXCVSModule</string> + <key>Proportion</key> + <string>262pt</string> + </dict> + </array> + <key>Proportion</key> + <string>266pt</string> + </dict> + </array> + <key>Name</key> + <string>SCM</string> + <key>ServiceClasses</key> + <array> + <string>PBXCVSModule</string> + </array> + <key>StatusbarIsVisible</key> + <integer>1</integer> + <key>TableOfContents</key> + <array> + <string>1C78EAB4065D492600B07095</string> + <string>1C78EAB5065D492600B07095</string> + <string>1C78EAB2065D492600B07095</string> + <string>1CD052920623707200166675</string> + </array> + <key>ToolbarConfiguration</key> + <string>xcode.toolbar.config.scm</string> + <key>WindowString</key> + <string>743 379 452 308 0 0 1280 1002 </string> + </dict> + <dict> + <key>Identifier</key> + <string>windowTool.breakpoints</string> + <key>IsVertical</key> + <integer>0</integer> + <key>Layout</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>BecomeActive</key> + <integer>1</integer> + <key>ContentConfiguration</key> + <dict> + <key>PBXBottomSmartGroupGIDs</key> + <array> + <string>1C77FABC04509CD000000102</string> + </array> + <key>PBXProjectModuleGUID</key> + <string>1CE0B1FE06471DED0097A5F4</string> + <key>PBXProjectModuleLabel</key> + <string>Files</string> + <key>PBXProjectStructureProvided</key> + <string>no</string> + <key>PBXSmartGroupTreeModuleColumnData</key> + <dict> + <key>PBXSmartGroupTreeModuleColumnWidthsKey</key> + <array> + <real>168</real> + </array> + <key>PBXSmartGroupTreeModuleColumnsKey_v4</key> + <array> + <string>MainColumn</string> + </array> + </dict> + <key>PBXSmartGroupTreeModuleOutlineStateKey_v7</key> + <dict> + <key>PBXSmartGroupTreeModuleOutlineStateExpansionKey</key> + <array> + <string>1C77FABC04509CD000000102</string> + </array> + <key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key> + <array> + <array> + <integer>0</integer> + </array> + </array> + <key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key> + <string>{{0, 0}, {168, 350}}</string> + </dict> + <key>PBXTopSmartGroupGIDs</key> + <array/> + <key>XCIncludePerspectivesSwitch</key> + <integer>0</integer> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{{0, 0}, {185, 368}}</string> + <key>GroupTreeTableConfiguration</key> + <array> + <string>MainColumn</string> + <real>168</real> + </array> + <key>RubberWindowFrame</key> + <string>315 424 744 409 0 0 1440 878 </string> + </dict> + <key>Module</key> + <string>PBXSmartGroupTreeModule</string> + <key>Proportion</key> + <string>185pt</string> + </dict> + <dict> + <key>ContentConfiguration</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>1CA1AED706398EBD00589147</string> + <key>PBXProjectModuleLabel</key> + <string>Detail</string> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{{190, 0}, {554, 368}}</string> + <key>RubberWindowFrame</key> + <string>315 424 744 409 0 0 1440 878 </string> + </dict> + <key>Module</key> + <string>XCDetailModule</string> + <key>Proportion</key> + <string>554pt</string> + </dict> + </array> + <key>Proportion</key> + <string>368pt</string> + </dict> + </array> + <key>MajorVersion</key> + <integer>3</integer> + <key>MinorVersion</key> + <integer>0</integer> + <key>Name</key> + <string>Breakpoints</string> + <key>ServiceClasses</key> + <array> + <string>PBXSmartGroupTreeModule</string> + <string>XCDetailModule</string> + </array> + <key>StatusbarIsVisible</key> + <integer>1</integer> + <key>TableOfContents</key> + <array> + <string>1CDDB66807F98D9800BB5817</string> + <string>1CDDB66907F98D9800BB5817</string> + <string>1CE0B1FE06471DED0097A5F4</string> + <string>1CA1AED706398EBD00589147</string> + </array> + <key>ToolbarConfiguration</key> + <string>xcode.toolbar.config.breakpointsV3</string> + <key>WindowString</key> + <string>315 424 744 409 0 0 1440 878 </string> + <key>WindowToolGUID</key> + <string>1CDDB66807F98D9800BB5817</string> + <key>WindowToolIsVisible</key> + <integer>1</integer> + </dict> + <dict> + <key>Identifier</key> + <string>windowTool.debugAnimator</string> + <key>Layout</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>Module</key> + <string>PBXNavigatorGroup</string> + <key>Proportion</key> + <string>100%</string> + </dict> + </array> + <key>Proportion</key> + <string>100%</string> + </dict> + </array> + <key>Name</key> + <string>Debug Visualizer</string> + <key>ServiceClasses</key> + <array> + <string>PBXNavigatorGroup</string> + </array> + <key>StatusbarIsVisible</key> + <integer>1</integer> + <key>ToolbarConfiguration</key> + <string>xcode.toolbar.config.debugAnimatorV3</string> + <key>WindowString</key> + <string>100 100 700 500 0 0 1280 1002 </string> + </dict> + <dict> + <key>Identifier</key> + <string>windowTool.bookmarks</string> + <key>Layout</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>Module</key> + <string>PBXBookmarksModule</string> + <key>Proportion</key> + <string>100%</string> + </dict> + </array> + <key>Proportion</key> + <string>100%</string> + </dict> + </array> + <key>Name</key> + <string>Bookmarks</string> + <key>ServiceClasses</key> + <array> + <string>PBXBookmarksModule</string> + </array> + <key>StatusbarIsVisible</key> + <integer>0</integer> + <key>WindowString</key> + <string>538 42 401 187 0 0 1280 1002 </string> + </dict> + <dict> + <key>Identifier</key> + <string>windowTool.projectFormatConflicts</string> + <key>Layout</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>Module</key> + <string>XCProjectFormatConflictsModule</string> + <key>Proportion</key> + <string>100%</string> + </dict> + </array> + <key>Proportion</key> + <string>100%</string> + </dict> + </array> + <key>Name</key> + <string>Project Format Conflicts</string> + <key>ServiceClasses</key> + <array> + <string>XCProjectFormatConflictsModule</string> + </array> + <key>StatusbarIsVisible</key> + <integer>0</integer> + <key>WindowContentMinSize</key> + <string>450 300</string> + <key>WindowString</key> + <string>50 850 472 307 0 0 1440 877</string> + </dict> + <dict> + <key>Identifier</key> + <string>windowTool.classBrowser</string> + <key>Layout</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>BecomeActive</key> + <integer>1</integer> + <key>ContentConfiguration</key> + <dict> + <key>OptionsSetName</key> + <string>Hierarchy, all classes</string> + <key>PBXProjectModuleGUID</key> + <string>1CA6456E063B45B4001379D8</string> + <key>PBXProjectModuleLabel</key> + <string>Class Browser - NSObject</string> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>ClassesFrame</key> + <string>{{0, 0}, {374, 96}}</string> + <key>ClassesTreeTableConfiguration</key> + <array> + <string>PBXClassNameColumnIdentifier</string> + <real>208</real> + <string>PBXClassBookColumnIdentifier</string> + <real>22</real> + </array> + <key>Frame</key> + <string>{{0, 0}, {630, 331}}</string> + <key>MembersFrame</key> + <string>{{0, 105}, {374, 395}}</string> + <key>MembersTreeTableConfiguration</key> + <array> + <string>PBXMemberTypeIconColumnIdentifier</string> + <real>22</real> + <string>PBXMemberNameColumnIdentifier</string> + <real>216</real> + <string>PBXMemberTypeColumnIdentifier</string> + <real>97</real> + <string>PBXMemberBookColumnIdentifier</string> + <real>22</real> + </array> + <key>PBXModuleWindowStatusBarHidden2</key> + <integer>1</integer> + <key>RubberWindowFrame</key> + <string>385 179 630 352 0 0 1440 878 </string> + </dict> + <key>Module</key> + <string>PBXClassBrowserModule</string> + <key>Proportion</key> + <string>332pt</string> + </dict> + </array> + <key>Proportion</key> + <string>332pt</string> + </dict> + </array> + <key>Name</key> + <string>Class Browser</string> + <key>ServiceClasses</key> + <array> + <string>PBXClassBrowserModule</string> + </array> + <key>StatusbarIsVisible</key> + <integer>0</integer> + <key>TableOfContents</key> + <array> + <string>1C0AD2AF069F1E9B00FABCE6</string> + <string>1C0AD2B0069F1E9B00FABCE6</string> + <string>1CA6456E063B45B4001379D8</string> + </array> + <key>ToolbarConfiguration</key> + <string>xcode.toolbar.config.classbrowser</string> + <key>WindowString</key> + <string>385 179 630 352 0 0 1440 878 </string> + <key>WindowToolGUID</key> + <string>1C0AD2AF069F1E9B00FABCE6</string> + <key>WindowToolIsVisible</key> + <integer>0</integer> + </dict> + <dict> + <key>Identifier</key> + <string>windowTool.refactoring</string> + <key>IncludeInToolsMenu</key> + <integer>0</integer> + <key>Layout</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>BecomeActive</key> + <integer>1</integer> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{0, 0}, {500, 335}</string> + <key>RubberWindowFrame</key> + <string>{0, 0}, {500, 335}</string> + </dict> + <key>Module</key> + <string>XCRefactoringModule</string> + <key>Proportion</key> + <string>100%</string> + </dict> + </array> + <key>Proportion</key> + <string>100%</string> + </dict> + </array> + <key>Name</key> + <string>Refactoring</string> + <key>ServiceClasses</key> + <array> + <string>XCRefactoringModule</string> + </array> + <key>WindowString</key> + <string>200 200 500 356 0 0 1920 1200 </string> + </dict> + </array> +</dict> +</plist> diff --git a/support/PyKerberos.xcodeproj/.svn/text-base/cyrusdaboo.pbxuser.svn-base b/support/PyKerberos.xcodeproj/.svn/text-base/cyrusdaboo.pbxuser.svn-base new file mode 100644 index 0000000..4b51fd8 --- /dev/null +++ b/support/PyKerberos.xcodeproj/.svn/text-base/cyrusdaboo.pbxuser.svn-base @@ -0,0 +1,706 @@ +// !$*UTF8*$! +{ + 08FB7793FE84155DC02AAC07 /* Project object */ = { + activeBuildConfigurationName = Debug; + activeExecutable = AFDE37EE0BB41DF9008C037E /* PyKerberos */; + activeSDKPreference = macosx10.6; + activeTarget = 8DD76F620486A84900D96B5E /* PyKerberos */; + addToTargets = ( + 8DD76F620486A84900D96B5E /* PyKerberos */, + ); + breakpoints = ( + AF4480A50BB4292300408822 /* kerberosbasic.c:35 */, + AF4480C10BB42C1E00408822 /* kerberosbasic.c:92 */, + AF4480CD0BB42CFF00408822 /* main.c:23 */, + AF4480D80BB42D6100408822 /* kerberosgss.c:253 */, + ); + codeSenseManager = AFDE37F60BB41E00008C037E /* Code sense */; + executables = ( + AFDE37EE0BB41DF9008C037E /* PyKerberos */, + ); + perUserDictionary = { + PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = { + PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; + PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; + PBXFileTableDataSourceColumnWidthsKey = ( + 20, + 1384, + 20, + 48, + 43, + 43, + 20, + ); + PBXFileTableDataSourceColumnsKey = ( + PBXFileDataSource_FiletypeID, + PBXFileDataSource_Filename_ColumnID, + PBXFileDataSource_Built_ColumnID, + PBXFileDataSource_ObjectSize_ColumnID, + PBXFileDataSource_Errors_ColumnID, + PBXFileDataSource_Warnings_ColumnID, + PBXFileDataSource_Target_ColumnID, + ); + }; + PBXPerProjectTemplateStateSaveDate = 263863739; + PBXWorkspaceStateSaveDate = 263863739; + }; + perUserProjectItems = { + AF4480AD0BB42BFD00408822 = AF4480AD0BB42BFD00408822 /* PBXTextBookmark */; + AF4480AF0BB42BFD00408822 = AF4480AF0BB42BFD00408822 /* PBXTextBookmark */; + AF4480B00BB42BFD00408822 = AF4480B00BB42BFD00408822 /* PBXTextBookmark */; + AF4480CF0BB42D1700408822 = AF4480CF0BB42D1700408822 /* PBXTextBookmark */; + AF4480DF0BB42E3C00408822 = AF4480DF0BB42E3C00408822 /* PBXTextBookmark */; + AF88E92D0FBA3EB400C5AA9C /* PBXTextBookmark */ = AF88E92D0FBA3EB400C5AA9C /* PBXTextBookmark */; + AF88E92E0FBA3EB400C5AA9C /* PBXTextBookmark */ = AF88E92E0FBA3EB400C5AA9C /* PBXTextBookmark */; + AF88E9300FBA3EB400C5AA9C /* PBXTextBookmark */ = AF88E9300FBA3EB400C5AA9C /* PBXTextBookmark */; + AF88E9400FBA3FD300C5AA9C /* XCBuildMessageTextBookmark */ = AF88E9400FBA3FD300C5AA9C /* XCBuildMessageTextBookmark */; + AF88E9410FBA3FD300C5AA9C /* PBXTextBookmark */ = AF88E9410FBA3FD300C5AA9C /* PBXTextBookmark */; + AF88E94C0FBA407500C5AA9C /* PBXTextBookmark */ = AF88E94C0FBA407500C5AA9C /* PBXTextBookmark */; + AF88E9560FBA419E00C5AA9C /* PBXTextBookmark */ = AF88E9560FBA419E00C5AA9C /* PBXTextBookmark */; + AF88E95C0FBA41D300C5AA9C /* PBXTextBookmark */ = AF88E95C0FBA41D300C5AA9C /* PBXTextBookmark */; + AF88E95D0FBA41D300C5AA9C /* PBXTextBookmark */ = AF88E95D0FBA41D300C5AA9C /* PBXTextBookmark */; + AF88E95E0FBA41D300C5AA9C /* PBXTextBookmark */ = AF88E95E0FBA41D300C5AA9C /* PBXTextBookmark */; + AF88E95F0FBA41D300C5AA9C /* PBXTextBookmark */ = AF88E95F0FBA41D300C5AA9C /* PBXTextBookmark */; + AF88E9600FBA41D300C5AA9C /* PBXTextBookmark */ = AF88E9600FBA41D300C5AA9C /* PBXTextBookmark */; + AF88E9610FBA41D300C5AA9C /* PBXTextBookmark */ = AF88E9610FBA41D300C5AA9C /* PBXTextBookmark */; + AF88E9620FBA41D300C5AA9C /* PBXTextBookmark */ = AF88E9620FBA41D300C5AA9C /* PBXTextBookmark */; + AF88E9630FBA41D300C5AA9C /* PBXTextBookmark */ = AF88E9630FBA41D300C5AA9C /* PBXTextBookmark */; + AF88E9660FBA435000C5AA9C /* PBXTextBookmark */ = AF88E9660FBA435000C5AA9C /* PBXTextBookmark */; + AF88E9670FBA435000C5AA9C /* PBXTextBookmark */ = AF88E9670FBA435000C5AA9C /* PBXTextBookmark */; + AF88E9680FBA435000C5AA9C /* PBXTextBookmark */ = AF88E9680FBA435000C5AA9C /* PBXTextBookmark */; + AF88E9690FBA435000C5AA9C /* PBXTextBookmark */ = AF88E9690FBA435000C5AA9C /* PBXTextBookmark */; + AF88E96A0FBA435000C5AA9C /* PBXTextBookmark */ = AF88E96A0FBA435000C5AA9C /* PBXTextBookmark */; + AF88E96B0FBA435000C5AA9C /* PBXTextBookmark */ = AF88E96B0FBA435000C5AA9C /* PBXTextBookmark */; + AF88E96C0FBA438E00C5AA9C /* PBXTextBookmark */ = AF88E96C0FBA438E00C5AA9C /* PBXTextBookmark */; + AF88E96D0FBA43A100C5AA9C /* PBXTextBookmark */ = AF88E96D0FBA43A100C5AA9C /* PBXTextBookmark */; + AF88E96E0FBA43B300C5AA9C /* PBXTextBookmark */ = AF88E96E0FBA43B300C5AA9C /* PBXTextBookmark */; + AF88E96F0FBA43D100C5AA9C /* PBXTextBookmark */ = AF88E96F0FBA43D100C5AA9C /* PBXTextBookmark */; + AF88E9700FBA441100C5AA9C /* PBXTextBookmark */ = AF88E9700FBA441100C5AA9C /* PBXTextBookmark */; + AF88E9710FBA441B00C5AA9C /* PBXTextBookmark */ = AF88E9710FBA441B00C5AA9C /* PBXTextBookmark */; + AF88E9720FBA442300C5AA9C /* PBXTextBookmark */ = AF88E9720FBA442300C5AA9C /* PBXTextBookmark */; + AF88E9730FBA443200C5AA9C /* PBXTextBookmark */ = AF88E9730FBA443200C5AA9C /* PBXTextBookmark */; + AF88E97A0FBA449500C5AA9C /* PBXTextBookmark */ = AF88E97A0FBA449500C5AA9C /* PBXTextBookmark */; + AF88E97B0FBA449500C5AA9C /* PBXTextBookmark */ = AF88E97B0FBA449500C5AA9C /* PBXTextBookmark */; + AFDE38700BB420B1008C037E = AFDE38700BB420B1008C037E /* PBXTextBookmark */; + AFDE38870BB42287008C037E = AFDE38870BB42287008C037E /* PBXTextBookmark */; + AFDE388A0BB42287008C037E = AFDE388A0BB42287008C037E /* PBXTextBookmark */; + AFDE388E0BB42287008C037E = AFDE388E0BB42287008C037E /* PBXTextBookmark */; + }; + sourceControlManager = AFDE37F50BB41E00008C037E /* Source Control */; + userBuildSettings = { + }; + }; + 08FB7796FE84155DC02AAC07 /* main.c */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1562, 616}}"; + sepNavSelRange = "{1055, 0}"; + sepNavVisRange = "{0, 1131}"; + sepNavVisRect = "{{0, 0}, {984, 308}}"; + sepNavWindowFrame = "{{485, -20}, {1395, 1160}}"; + }; + }; + 8DD76F620486A84900D96B5E /* PyKerberos */ = { + activeExec = 0; + executables = ( + AFDE37EE0BB41DF9008C037E /* PyKerberos */, + ); + }; + AF4480A50BB4292300408822 /* kerberosbasic.c:35 */ = { + isa = PBXFileBreakpoint; + actions = ( + ); + breakpointStyle = 0; + continueAfterActions = 0; + countType = 0; + delayBeforeContinue = 0; + fileReference = AFDE37FA0BB41E1D008C037E /* kerberosbasic.c */; + functionName = "authenticate_user_krb5pwd(const char *user, const char *pswd, const char *service, const char *default_realm)"; + hitCount = 0; + ignoreCount = 0; + lineNumber = 35; + location = PyKerberos; + modificationTime = 263864776.548559; + originalNumberOfMultipleMatches = 1; + state = 1; + }; + AF4480AD0BB42BFD00408822 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE37FC0BB41E1D008C037E /* kerberosgss.c */; + name = "kerberosgss.c: 47"; + rLen = 0; + rLoc = 1293; + rType = 0; + vrLen = 930; + vrLoc = 867; + }; + AF4480AF0BB42BFD00408822 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 08FB7796FE84155DC02AAC07 /* main.c */; + name = "main.c: 4"; + rLen = 0; + rLoc = 45; + rType = 0; + vrLen = 405; + vrLoc = 0; + }; + AF4480B00BB42BFD00408822 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE37FC0BB41E1D008C037E /* kerberosgss.c */; + name = "kerberosgss.c: 47"; + rLen = 0; + rLoc = 1293; + rType = 0; + vrLen = 930; + vrLoc = 867; + }; + AF4480C10BB42C1E00408822 /* kerberosbasic.c:92 */ = { + isa = PBXFileBreakpoint; + actions = ( + ); + breakpointStyle = 0; + continueAfterActions = 0; + countType = 0; + delayBeforeContinue = 0; + fileReference = AFDE37FA0BB41E1D008C037E /* kerberosbasic.c */; + functionName = "authenticate_user_krb5pwd(const char *user, const char *pswd, const char *service, const char *default_realm)"; + hitCount = 0; + ignoreCount = 0; + lineNumber = 92; + location = PyKerberos; + modificationTime = 263864776.583793; + originalNumberOfMultipleMatches = 1; + state = 1; + }; + AF4480CD0BB42CFF00408822 /* main.c:23 */ = { + isa = PBXFileBreakpoint; + actions = ( + ); + breakpointStyle = 0; + continueAfterActions = 0; + countType = 0; + delayBeforeContinue = 0; + fileReference = 08FB7796FE84155DC02AAC07 /* main.c */; + functionName = "main()"; + hitCount = 1; + ignoreCount = 0; + lineNumber = 23; + location = PyKerberos; + modificationTime = 263864776.766891; + originalNumberOfMultipleMatches = 1; + state = 1; + }; + AF4480CF0BB42D1700408822 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + comments = "error: syntax error before 'gss_server_state'"; + fRef = 08FB7796FE84155DC02AAC07 /* main.c */; + rLen = 1; + rLoc = 17; + rType = 1; + }; + AF4480D80BB42D6100408822 /* kerberosgss.c:253 */ = { + isa = PBXFileBreakpoint; + actions = ( + ); + breakpointStyle = 0; + continueAfterActions = 0; + countType = 0; + delayBeforeContinue = 0; + fileReference = AFDE37FC0BB41E1D008C037E /* kerberosgss.c */; + functionName = "authenticate_gss_server_init(const char* service, gss_server_state *state)"; + hitCount = 0; + ignoreCount = 0; + lineNumber = 253; + location = PyKerberos; + modificationTime = 263864776.633991; + originalNumberOfMultipleMatches = 1; + state = 1; + }; + AF4480DF0BB42E3C00408822 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 08FB7796FE84155DC02AAC07 /* main.c */; + name = "main.c: 18"; + rLen = 0; + rLoc = 511; + rType = 0; + vrLen = 584; + vrLoc = 0; + }; + AF88E92D0FBA3EB400C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE37FC0BB41E1D008C037E /* kerberosgss.c */; + name = "kerberosgss.c: 498"; + rLen = 0; + rLoc = 15211; + rType = 0; + vrLen = 1613; + vrLoc = 12775; + }; + AF88E92E0FBA3EB400C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AF88E92F0FBA3EB400C5AA9C /* gssapi.h */; + rLen = 1; + rLoc = 203; + rType = 1; + }; + AF88E92F0FBA3EB400C5AA9C /* gssapi.h */ = { + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = gssapi.h; + path = /Developer/SDKs/MacOSX10.5.sdk/usr/include/gssapi/gssapi.h; + sourceTree = "<absolute>"; + }; + AF88E9300FBA3EB400C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AF88E9310FBA3EB400C5AA9C /* gssapi.h */; + name = "gssapi.h: 204"; + rLen = 48; + rLoc = 5223; + rType = 0; + vrLen = 1593; + vrLoc = 4463; + }; + AF88E9310FBA3EB400C5AA9C /* gssapi.h */ = { + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = gssapi.h; + path = /Developer/SDKs/MacOSX10.5.sdk/usr/include/gssapi/gssapi.h; + sourceTree = "<absolute>"; + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1651, 10504}}"; + sepNavSelRange = "{18918, 19}"; + sepNavVisRange = "{18293, 1476}"; + }; + }; + AF88E9400FBA3FD300C5AA9C /* XCBuildMessageTextBookmark */ = { + isa = XCBuildMessageTextBookmark; + comments = "Python.h: No such file or directory"; + fRef = AFDE37FA0BB41E1D008C037E /* kerberosbasic.c */; + rLen = 1; + rLoc = 16; + rType = 1; + }; + AF88E9410FBA3FD300C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE37FA0BB41E1D008C037E /* kerberosbasic.c */; + name = "kerberosbasic.c: 17"; + rLen = 0; + rLoc = 627; + rType = 0; + vrLen = 450; + vrLoc = 300; + }; + AF88E94C0FBA407500C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE37FA0BB41E1D008C037E /* kerberosbasic.c */; + name = "kerberosbasic.c: 17"; + rLen = 0; + rLoc = 627; + rType = 0; + vrLen = 1616; + vrLoc = 0; + }; + AF88E94E0FBA416E00C5AA9C /* kerberospw.c */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1562, 1781}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRange = "{0, 1509}"; + }; + }; + AF88E94F0FBA416E00C5AA9C /* kerberospw.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1562, 616}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRange = "{0, 867}"; + }; + }; + AF88E9560FBA419E00C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE37FA0BB41E1D008C037E /* kerberosbasic.c */; + name = "kerberosbasic.c: 17"; + rLen = 0; + rLoc = 627; + rType = 0; + vrLen = 1487; + vrLoc = 0; + }; + AF88E95C0FBA41D300C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE37FC0BB41E1D008C037E /* kerberosgss.c */; + name = "kerberosgss.c: 496"; + rLen = 22; + rLoc = 15065; + rType = 0; + vrLen = 1715; + vrLoc = 14638; + }; + AF88E95D0FBA41D300C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AF88E9310FBA3EB400C5AA9C /* gssapi.h */; + name = "gssapi.h: 585"; + rLen = 19; + rLoc = 18918; + rType = 0; + vrLen = 1476; + vrLoc = 18293; + }; + AF88E95E0FBA41D300C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE383A0BB41FFA008C037E /* kerberos.c */; + name = "kerberos.c: 39"; + rLen = 25; + rLoc = 1160; + rType = 0; + vrLen = 1124; + vrLoc = 992; + }; + AF88E95F0FBA41D300C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE37FA0BB41E1D008C037E /* kerberosbasic.c */; + name = "kerberosbasic.c: 27"; + rLen = 63; + rLoc = 806; + rType = 0; + vrLen = 1617; + vrLoc = 63; + }; + AF88E9600FBA41D300C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AF88E94F0FBA416E00C5AA9C /* kerberospw.h */; + name = "kerberospw.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 867; + vrLoc = 0; + }; + AF88E9610FBA41D300C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AF88E94E0FBA416E00C5AA9C /* kerberospw.c */; + name = "kerberospw.c: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1509; + vrLoc = 0; + }; + AF88E9620FBA41D300C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 08FB7796FE84155DC02AAC07 /* main.c */; + rLen = 0; + rLoc = 22; + rType = 1; + }; + AF88E9630FBA41D300C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 08FB7796FE84155DC02AAC07 /* main.c */; + name = "main.c: 33"; + rLen = 0; + rLoc = 1055; + rType = 0; + vrLen = 1131; + vrLoc = 0; + }; + AF88E9660FBA435000C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 08FB7796FE84155DC02AAC07 /* main.c */; + name = "main.c: 33"; + rLen = 0; + rLoc = 1055; + rType = 0; + vrLen = 1131; + vrLoc = 0; + }; + AF88E9670FBA435000C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE383A0BB41FFA008C037E /* kerberos.c */; + name = "kerberos.c: 415"; + rLen = 0; + rLoc = 11472; + rType = 0; + vrLen = 1178; + vrLoc = 7396; + }; + AF88E9680FBA435000C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE37FB0BB41E1D008C037E /* kerberosbasic.h */; + name = "kerberosbasic.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 898; + vrLoc = 0; + }; + AF88E9690FBA435000C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE37FD0BB41E1D008C037E /* kerberosgss.h */; + name = "kerberosgss.h: 46"; + rLen = 0; + rLoc = 1419; + rType = 0; + vrLen = 1615; + vrLoc = 587; + }; + AF88E96A0FBA435000C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE37FC0BB41E1D008C037E /* kerberosgss.c */; + name = "kerberosgss.c: 496"; + rLen = 22; + rLoc = 15065; + rType = 0; + vrLen = 1710; + vrLoc = 14638; + }; + AF88E96B0FBA435000C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE37FC0BB41E1D008C037E /* kerberosgss.c */; + name = "kerberosgss.c: 539"; + rLen = 0; + rLoc = 17377; + rType = 0; + vrLen = 1293; + vrLoc = 15634; + }; + AF88E96C0FBA438E00C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE37FC0BB41E1D008C037E /* kerberosgss.c */; + name = "kerberosgss.c: 543"; + rLen = 19; + rLoc = 16673; + rType = 0; + vrLen = 1714; + vrLoc = 15772; + }; + AF88E96D0FBA43A100C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE37FC0BB41E1D008C037E /* kerberosgss.c */; + name = "kerberosgss.c: 543"; + rLen = 0; + rLoc = 16692; + rType = 0; + vrLen = 1563; + vrLoc = 15772; + }; + AF88E96E0FBA43B300C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE37FC0BB41E1D008C037E /* kerberosgss.c */; + name = "kerberosgss.c: 543"; + rLen = 0; + rLoc = 16718; + rType = 0; + vrLen = 1588; + vrLoc = 15777; + }; + AF88E96F0FBA43D100C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE37FC0BB41E1D008C037E /* kerberosgss.c */; + name = "kerberosgss.c: 543"; + rLen = 0; + rLoc = 16726; + rType = 0; + vrLen = 1594; + vrLoc = 15777; + }; + AF88E9700FBA441100C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE37FC0BB41E1D008C037E /* kerberosgss.c */; + name = "kerberosgss.c: 544"; + rLen = 0; + rLoc = 16738; + rType = 0; + vrLen = 1483; + vrLoc = 16048; + }; + AF88E9710FBA441B00C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE37FC0BB41E1D008C037E /* kerberosgss.c */; + name = "kerberosgss.c: 544"; + rLen = 0; + rLoc = 16768; + rType = 0; + vrLen = 1484; + vrLoc = 16048; + }; + AF88E9720FBA442300C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE37FC0BB41E1D008C037E /* kerberosgss.c */; + name = "kerberosgss.c: 544"; + rLen = 0; + rLoc = 16768; + rType = 0; + vrLen = 1491; + vrLoc = 16048; + }; + AF88E9730FBA443200C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE37FC0BB41E1D008C037E /* kerberosgss.c */; + name = "kerberosgss.c: 544"; + rLen = 0; + rLoc = 16768; + rType = 0; + vrLen = 1503; + vrLoc = 16048; + }; + AF88E97A0FBA449500C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE37FC0BB41E1D008C037E /* kerberosgss.c */; + name = "kerberosgss.c: 529"; + rLen = 16; + rLoc = 16093; + rType = 0; + vrLen = 1576; + vrLoc = 15766; + }; + AF88E97B0FBA449500C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE37FC0BB41E1D008C037E /* kerberosgss.c */; + name = "kerberosgss.c: 551"; + rLen = 0; + rLoc = 16985; + rType = 0; + vrLen = 1596; + vrLoc = 16048; + }; + AFDE37EE0BB41DF9008C037E /* PyKerberos */ = { + isa = PBXExecutable; + activeArgIndices = ( + ); + argumentStrings = ( + ); + autoAttachOnCrash = 1; + breakpointsEnabled = 1; + configStateDict = { + }; + customDataFormattersEnabled = 1; + dataTipCustomDataFormattersEnabled = 1; + dataTipShowTypeColumn = 1; + dataTipSortType = 0; + debuggerPlugin = GDBDebugging; + disassemblyDisplayState = 0; + dylibVariantSuffix = ""; + enableDebugStr = 1; + environmentEntries = ( + ); + executableSystemSymbolLevel = 0; + executableUserSymbolLevel = 0; + libgmallocEnabled = 0; + name = PyKerberos; + savedGlobals = { + }; + showTypeColumn = 0; + sourceDirectories = ( + ); + variableFormatDictionary = { + }; + }; + AFDE37F50BB41E00008C037E /* Source Control */ = { + isa = PBXSourceControlManager; + fallbackIsa = XCSourceControlManager; + isSCMEnabled = 0; + repositoryNamesForRoots = { + }; + scmConfiguration = { + repositoryNamesForRoots = { + }; + }; + }; + AFDE37F60BB41E00008C037E /* Code sense */ = { + isa = PBXCodeSenseManager; + indexTemplatePath = ""; + }; + AFDE37F80BB41E1D008C037E /* base64.c */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {991, 1316}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 437}, {991, 524}}"; + }; + }; + AFDE37FA0BB41E1D008C037E /* kerberosbasic.c */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1283, 1846}}"; + sepNavSelRange = "{627, 0}"; + sepNavVisRange = "{0, 1616}"; + sepNavVisRect = "{{0, 325}, {984, 316}}"; + }; + }; + AFDE37FB0BB41E1D008C037E /* kerberosbasic.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1562, 616}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRange = "{0, 898}"; + sepNavVisRect = "{{0, 0}, {1336, 1031}}"; + sepNavWindowFrame = "{{15, 13}, {1395, 1160}}"; + }; + }; + AFDE37FC0BB41E1D008C037E /* kerberosgss.c */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1562, 7969}}"; + sepNavSelRange = "{16985, 0}"; + sepNavVisRange = "{16048, 1596}"; + sepNavVisRect = "{{0, 2485}, {984, 308}}"; + }; + }; + AFDE37FD0BB41E1D008C037E /* kerberosgss.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1562, 793}}"; + sepNavSelRange = "{1419, 0}"; + sepNavVisRange = "{587, 1615}"; + sepNavVisRect = "{{0, 0}, {1336, 1031}}"; + sepNavWindowFrame = "{{15, 13}, {1395, 1160}}"; + }; + }; + AFDE383A0BB41FFA008C037E /* kerberos.c */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1562, 5733}}"; + sepNavSelRange = "{11472, 0}"; + sepNavVisRange = "{7396, 1178}"; + sepNavVisRect = "{{0, 0}, {932, 292}}"; + }; + }; + AFDE38700BB420B1008C037E /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 08FB7796FE84155DC02AAC07 /* main.c */; + name = "main.cpp: 9"; + rLen = 0; + rLoc = 155; + rType = 0; + vrLen = 249; + vrLoc = 0; + }; + AFDE38720BB420B1008C037E /* iostream */ = { + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.h; + name = iostream; + path = "/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/iostream"; + sourceTree = "<absolute>"; + }; + AFDE38870BB42287008C037E /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE38720BB420B1008C037E /* iostream */; + name = "iostream: 76"; + rLen = 0; + rLoc = 2873; + rType = 0; + vrLen = 1307; + vrLoc = 1651; + }; + AFDE388A0BB42287008C037E /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE38720BB420B1008C037E /* iostream */; + name = "iostream: 76"; + rLen = 0; + rLoc = 2873; + rType = 0; + vrLen = 1307; + vrLoc = 1651; + }; + AFDE388E0BB42287008C037E /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE37FC0BB41E1D008C037E /* kerberosgss.c */; + name = "kerberosgss.c: 47"; + rLen = 0; + rLoc = 1298; + rType = 0; + vrLen = 1144; + vrLoc = 1097; + }; +} diff --git a/support/PyKerberos.xcodeproj/.svn/text-base/project.pbxproj.svn-base b/support/PyKerberos.xcodeproj/.svn/text-base/project.pbxproj.svn-base new file mode 100644 index 0000000..90ffc03 --- /dev/null +++ b/support/PyKerberos.xcodeproj/.svn/text-base/project.pbxproj.svn-base @@ -0,0 +1,252 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 44; + objects = { + +/* Begin PBXBuildFile section */ + 8DD76F650486A84900D96B5E /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 08FB7796FE84155DC02AAC07 /* main.c */; settings = {ATTRIBUTES = (); }; }; + 8DD76F6A0486A84900D96B5E /* PyKerberos.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = C6859E8B029090EE04C91782 /* PyKerberos.1 */; }; + AF88E9500FBA416E00C5AA9C /* kerberospw.c in Sources */ = {isa = PBXBuildFile; fileRef = AF88E94E0FBA416E00C5AA9C /* kerberospw.c */; }; + AFDE37FE0BB41E1D008C037E /* base64.c in Sources */ = {isa = PBXBuildFile; fileRef = AFDE37F80BB41E1D008C037E /* base64.c */; }; + AFDE37FF0BB41E1D008C037E /* kerberosbasic.c in Sources */ = {isa = PBXBuildFile; fileRef = AFDE37FA0BB41E1D008C037E /* kerberosbasic.c */; }; + AFDE38000BB41E1D008C037E /* kerberosgss.c in Sources */ = {isa = PBXBuildFile; fileRef = AFDE37FC0BB41E1D008C037E /* kerberosgss.c */; }; + AFDE380C0BB41EB7008C037E /* Python.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AFDE380B0BB41EB7008C037E /* Python.framework */; }; + AFDE38340BB41FCE008C037E /* Kerberos.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AFDE38330BB41FCE008C037E /* Kerberos.framework */; }; + AFDE383B0BB41FFA008C037E /* kerberos.c in Sources */ = {isa = PBXBuildFile; fileRef = AFDE383A0BB41FFA008C037E /* kerberos.c */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 8DD76F690486A84900D96B5E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 8; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + 8DD76F6A0486A84900D96B5E /* PyKerberos.1 in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 1; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 08FB7796FE84155DC02AAC07 /* main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = "<group>"; }; + 8DD76F6C0486A84900D96B5E /* PyKerberos */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = PyKerberos; sourceTree = BUILT_PRODUCTS_DIR; }; + AF88E94E0FBA416E00C5AA9C /* kerberospw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = kerberospw.c; path = ../src/kerberospw.c; sourceTree = SOURCE_ROOT; }; + AF88E94F0FBA416E00C5AA9C /* kerberospw.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = kerberospw.h; path = ../src/kerberospw.h; sourceTree = SOURCE_ROOT; }; + AFDE37F80BB41E1D008C037E /* base64.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = base64.c; path = ../src/base64.c; sourceTree = SOURCE_ROOT; }; + AFDE37F90BB41E1D008C037E /* base64.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = base64.h; path = ../src/base64.h; sourceTree = SOURCE_ROOT; }; + AFDE37FA0BB41E1D008C037E /* kerberosbasic.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = kerberosbasic.c; path = ../src/kerberosbasic.c; sourceTree = SOURCE_ROOT; }; + AFDE37FB0BB41E1D008C037E /* kerberosbasic.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = kerberosbasic.h; path = ../src/kerberosbasic.h; sourceTree = SOURCE_ROOT; }; + AFDE37FC0BB41E1D008C037E /* kerberosgss.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = kerberosgss.c; path = ../src/kerberosgss.c; sourceTree = SOURCE_ROOT; }; + AFDE37FD0BB41E1D008C037E /* kerberosgss.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = kerberosgss.h; path = ../src/kerberosgss.h; sourceTree = SOURCE_ROOT; }; + AFDE380B0BB41EB7008C037E /* Python.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Python.framework; path = /System/Library/Frameworks/Python.framework; sourceTree = "<absolute>"; }; + AFDE38330BB41FCE008C037E /* Kerberos.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Kerberos.framework; path = /System/Library/Frameworks/Kerberos.framework; sourceTree = "<absolute>"; }; + AFDE383A0BB41FFA008C037E /* kerberos.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = kerberos.c; path = ../src/kerberos.c; sourceTree = SOURCE_ROOT; }; + C6859E8B029090EE04C91782 /* PyKerberos.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = PyKerberos.1; sourceTree = "<group>"; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8DD76F660486A84900D96B5E /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + AFDE380C0BB41EB7008C037E /* Python.framework in Frameworks */, + AFDE38340BB41FCE008C037E /* Kerberos.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 08FB7794FE84155DC02AAC07 /* PyKerberos */ = { + isa = PBXGroup; + children = ( + 08FB7795FE84155DC02AAC07 /* Source */, + AFDE38300BB41F71008C037E /* Frameworks */, + C6859E8C029090F304C91782 /* Documentation */, + 1AB674ADFE9D54B511CA2CBB /* Products */, + ); + name = PyKerberos; + sourceTree = "<group>"; + }; + 08FB7795FE84155DC02AAC07 /* Source */ = { + isa = PBXGroup; + children = ( + AFDE383A0BB41FFA008C037E /* kerberos.c */, + AFDE37F80BB41E1D008C037E /* base64.c */, + AFDE37F90BB41E1D008C037E /* base64.h */, + AFDE37FA0BB41E1D008C037E /* kerberosbasic.c */, + AFDE37FB0BB41E1D008C037E /* kerberosbasic.h */, + AFDE37FC0BB41E1D008C037E /* kerberosgss.c */, + AFDE37FD0BB41E1D008C037E /* kerberosgss.h */, + AF88E94E0FBA416E00C5AA9C /* kerberospw.c */, + AF88E94F0FBA416E00C5AA9C /* kerberospw.h */, + 08FB7796FE84155DC02AAC07 /* main.c */, + ); + name = Source; + sourceTree = "<group>"; + }; + 1AB674ADFE9D54B511CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 8DD76F6C0486A84900D96B5E /* PyKerberos */, + ); + name = Products; + sourceTree = "<group>"; + }; + AFDE38300BB41F71008C037E /* Frameworks */ = { + isa = PBXGroup; + children = ( + AFDE38330BB41FCE008C037E /* Kerberos.framework */, + AFDE380B0BB41EB7008C037E /* Python.framework */, + ); + name = Frameworks; + sourceTree = "<group>"; + }; + C6859E8C029090F304C91782 /* Documentation */ = { + isa = PBXGroup; + children = ( + C6859E8B029090EE04C91782 /* PyKerberos.1 */, + ); + name = Documentation; + sourceTree = "<group>"; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 8DD76F620486A84900D96B5E /* PyKerberos */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1DEB923108733DC60010E9CD /* Build configuration list for PBXNativeTarget "PyKerberos" */; + buildPhases = ( + 8DD76F640486A84900D96B5E /* Sources */, + 8DD76F660486A84900D96B5E /* Frameworks */, + 8DD76F690486A84900D96B5E /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = PyKerberos; + productInstallPath = "$(HOME)/bin"; + productName = PyKerberos; + productReference = 8DD76F6C0486A84900D96B5E /* PyKerberos */; + productType = "com.apple.product-type.tool"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 08FB7793FE84155DC02AAC07 /* Project object */ = { + isa = PBXProject; + buildConfigurationList = 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "PyKerberos" */; + compatibilityVersion = "Xcode 3.0"; + hasScannedForEncodings = 1; + mainGroup = 08FB7794FE84155DC02AAC07 /* PyKerberos */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8DD76F620486A84900D96B5E /* PyKerberos */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 8DD76F640486A84900D96B5E /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DD76F650486A84900D96B5E /* main.c in Sources */, + AFDE37FE0BB41E1D008C037E /* base64.c in Sources */, + AFDE37FF0BB41E1D008C037E /* kerberosbasic.c in Sources */, + AFDE38000BB41E1D008C037E /* kerberosgss.c in Sources */, + AFDE383B0BB41FFA008C037E /* kerberos.c in Sources */, + AF88E9500FBA416E00C5AA9C /* kerberospw.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 1DEB923208733DC60010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "_GLIBCXX_DEBUG=1", + "_GLIBCXX_DEBUG_PEDANTIC=1", + ); + HEADER_SEARCH_PATHS = "/System/Library/Frameworks/Python.framework/Headers/**"; + INSTALL_PATH = /usr/local/bin; + PRODUCT_NAME = PyKerberos; + ZERO_LINK = YES; + }; + name = Debug; + }; + 1DEB923308733DC60010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = ( + ppc, + i386, + ); + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_MODEL_TUNING = G5; + HEADER_SEARCH_PATHS = "/System/Library/Frameworks/Python.framework/Headers/**"; + INSTALL_PATH = /usr/local/bin; + PRODUCT_NAME = PyKerberos; + }; + name = Release; + }; + 1DEB923608733DC60010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + PREBINDING = NO; + SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk"; + }; + name = Debug; + }; + 1DEB923708733DC60010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ""; + PREBINDING = NO; + SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk"; + USER_HEADER_SEARCH_PATHS = ..src; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1DEB923108733DC60010E9CD /* Build configuration list for PBXNativeTarget "PyKerberos" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB923208733DC60010E9CD /* Debug */, + 1DEB923308733DC60010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "PyKerberos" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB923608733DC60010E9CD /* Debug */, + 1DEB923708733DC60010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 08FB7793FE84155DC02AAC07 /* Project object */; +} diff --git a/support/PyKerberos.xcodeproj/cyrusdaboo.mode1v3 b/support/PyKerberos.xcodeproj/cyrusdaboo.mode1v3 new file mode 100644 index 0000000..a46d695 --- /dev/null +++ b/support/PyKerberos.xcodeproj/cyrusdaboo.mode1v3 @@ -0,0 +1,1409 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>ActivePerspectiveName</key> + <string>Project</string> + <key>AllowedModules</key> + <array> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>n</string> + <key>Module</key> + <string>PBXSmartGroupTreeModule</string> + <key>Name</key> + <string>Groups and Files Outline View</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>n</string> + <key>Module</key> + <string>PBXNavigatorGroup</string> + <key>Name</key> + <string>Editor</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>n</string> + <key>Module</key> + <string>XCTaskListModule</string> + <key>Name</key> + <string>Task List</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>n</string> + <key>Module</key> + <string>XCDetailModule</string> + <key>Name</key> + <string>File and Smart Group Detail Viewer</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>1</string> + <key>Module</key> + <string>PBXBuildResultsModule</string> + <key>Name</key> + <string>Detailed Build Results Viewer</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>1</string> + <key>Module</key> + <string>PBXProjectFindModule</string> + <key>Name</key> + <string>Project Batch Find Tool</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>n</string> + <key>Module</key> + <string>XCProjectFormatConflictsModule</string> + <key>Name</key> + <string>Project Format Conflicts List</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>n</string> + <key>Module</key> + <string>PBXBookmarksModule</string> + <key>Name</key> + <string>Bookmarks Tool</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>n</string> + <key>Module</key> + <string>PBXClassBrowserModule</string> + <key>Name</key> + <string>Class Browser</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>n</string> + <key>Module</key> + <string>PBXCVSModule</string> + <key>Name</key> + <string>Source Code Control Tool</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>n</string> + <key>Module</key> + <string>PBXDebugBreakpointsModule</string> + <key>Name</key> + <string>Debug Breakpoints Tool</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>n</string> + <key>Module</key> + <string>XCDockableInspector</string> + <key>Name</key> + <string>Inspector</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>n</string> + <key>Module</key> + <string>PBXOpenQuicklyModule</string> + <key>Name</key> + <string>Open Quickly Tool</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>1</string> + <key>Module</key> + <string>PBXDebugSessionModule</string> + <key>Name</key> + <string>Debugger</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>1</string> + <key>Module</key> + <string>PBXDebugCLIModule</string> + <key>Name</key> + <string>Debug Console</string> + </dict> + <dict> + <key>BundleLoadPath</key> + <string></string> + <key>MaxInstances</key> + <string>n</string> + <key>Module</key> + <string>XCSnapshotModule</string> + <key>Name</key> + <string>Snapshots Tool</string> + </dict> + </array> + <key>BundlePath</key> + <string>/Developer/Library/PrivateFrameworks/DevToolsInterface.framework/Resources</string> + <key>Description</key> + <string>DefaultDescriptionKey</string> + <key>DockingSystemVisible</key> + <false/> + <key>Extension</key> + <string>mode1v3</string> + <key>FavBarConfig</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>AF88E9340FBA3EB400C5AA9C</string> + <key>XCBarModuleItemNames</key> + <dict/> + <key>XCBarModuleItems</key> + <array/> + </dict> + <key>FirstTimeWindowDisplayed</key> + <false/> + <key>Identifier</key> + <string>com.apple.perspectives.project.mode1v3</string> + <key>MajorVersion</key> + <integer>33</integer> + <key>MinorVersion</key> + <integer>0</integer> + <key>Name</key> + <string>Default</string> + <key>Notifications</key> + <array/> + <key>OpenEditors</key> + <array/> + <key>PerspectiveWidths</key> + <array> + <integer>-1</integer> + <integer>-1</integer> + </array> + <key>Perspectives</key> + <array> + <dict> + <key>ChosenToolbarItems</key> + <array> + <string>active-combo-popup</string> + <string>action</string> + <string>NSToolbarFlexibleSpaceItem</string> + <string>buildOrClean</string> + <string>build-and-go</string> + <string>go</string> + <string>servicesModulebuild</string> + <string>debugger-enable-breakpoints</string> + <string>com.apple.ide.PBXToolbarStopButton</string> + <string>toggle-editor</string> + <string>get-info</string> + <string>NSToolbarFlexibleSpaceItem</string> + <string>com.apple.pbx.toolbar.searchfield</string> + </array> + <key>ControllerClassBaseName</key> + <string></string> + <key>IconName</key> + <string>WindowOfProjectWithEditor</string> + <key>Identifier</key> + <string>perspective.project</string> + <key>IsVertical</key> + <false/> + <key>Layout</key> + <array> + <dict> + <key>ContentConfiguration</key> + <dict> + <key>PBXBottomSmartGroupGIDs</key> + <array> + <string>1C37FBAC04509CD000000102</string> + <string>1C37FAAC04509CD000000102</string> + <string>1C37FABC05509CD000000102</string> + <string>1C37FABC05539CD112110102</string> + <string>E2644B35053B69B200211256</string> + <string>1C37FABC04509CD000100104</string> + <string>1CC0EA4004350EF90044410B</string> + <string>1CC0EA4004350EF90041110B</string> + </array> + <key>PBXProjectModuleGUID</key> + <string>1CE0B1FE06471DED0097A5F4</string> + <key>PBXProjectModuleLabel</key> + <string>Files</string> + <key>PBXProjectStructureProvided</key> + <string>yes</string> + <key>PBXSmartGroupTreeModuleColumnData</key> + <dict> + <key>PBXSmartGroupTreeModuleColumnWidthsKey</key> + <array> + <real>275</real> + </array> + <key>PBXSmartGroupTreeModuleColumnsKey_v4</key> + <array> + <string>MainColumn</string> + </array> + </dict> + <key>PBXSmartGroupTreeModuleOutlineStateKey_v7</key> + <dict> + <key>PBXSmartGroupTreeModuleOutlineStateExpansionKey</key> + <array> + <string>08FB7794FE84155DC02AAC07</string> + <string>08FB7795FE84155DC02AAC07</string> + <string>AFDE38300BB41F71008C037E</string> + <string>1C37FABC05509CD000000102</string> + </array> + <key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key> + <array> + <array> + <integer>7</integer> + <integer>1</integer> + <integer>0</integer> + </array> + </array> + <key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key> + <string>{{0, 0}, {275, 1060}}</string> + </dict> + <key>PBXTopSmartGroupGIDs</key> + <array/> + <key>XCIncludePerspectivesSwitch</key> + <true/> + <key>XCSharingToken</key> + <string>com.apple.Xcode.GFSharingToken</string> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{{0, 0}, {292, 1078}}</string> + <key>GroupTreeTableConfiguration</key> + <array> + <string>MainColumn</string> + <real>275</real> + </array> + <key>RubberWindowFrame</key> + <string>0 59 1920 1119 0 0 1920 1178 </string> + </dict> + <key>Module</key> + <string>PBXSmartGroupTreeModule</string> + <key>Proportion</key> + <string>292pt</string> + </dict> + <dict> + <key>Dock</key> + <array> + <dict> + <key>BecomeActive</key> + <true/> + <key>ContentConfiguration</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>1CE0B20306471E060097A5F4</string> + <key>PBXProjectModuleLabel</key> + <string>kerberosgss.c</string> + <key>PBXSplitModuleInNavigatorKey</key> + <dict> + <key>Split0</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>1CE0B20406471E060097A5F4</string> + <key>PBXProjectModuleLabel</key> + <string>kerberosgss.c</string> + <key>_historyCapacity</key> + <integer>0</integer> + <key>bookmark</key> + <string>AF88E97B0FBA449500C5AA9C</string> + <key>history</key> + <array> + <string>AF88E95D0FBA41D300C5AA9C</string> + <string>AF88E95F0FBA41D300C5AA9C</string> + <string>AF88E9600FBA41D300C5AA9C</string> + <string>AF88E9610FBA41D300C5AA9C</string> + <string>AF88E9660FBA435000C5AA9C</string> + <string>AF88E9670FBA435000C5AA9C</string> + <string>AF88E9680FBA435000C5AA9C</string> + <string>AF88E9690FBA435000C5AA9C</string> + <string>AF88E97A0FBA449500C5AA9C</string> + </array> + </dict> + <key>SplitCount</key> + <string>1</string> + </dict> + <key>StatusBarVisibility</key> + <true/> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{{0, 0}, {1623, 648}}</string> + <key>RubberWindowFrame</key> + <string>0 59 1920 1119 0 0 1920 1178 </string> + </dict> + <key>Module</key> + <string>PBXNavigatorGroup</string> + <key>Proportion</key> + <string>648pt</string> + </dict> + <dict> + <key>ContentConfiguration</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>1CE0B20506471E060097A5F4</string> + <key>PBXProjectModuleLabel</key> + <string>Detail</string> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{{0, 653}, {1623, 425}}</string> + <key>RubberWindowFrame</key> + <string>0 59 1920 1119 0 0 1920 1178 </string> + </dict> + <key>Module</key> + <string>XCDetailModule</string> + <key>Proportion</key> + <string>425pt</string> + </dict> + </array> + <key>Proportion</key> + <string>1623pt</string> + </dict> + </array> + <key>Name</key> + <string>Project</string> + <key>ServiceClasses</key> + <array> + <string>XCModuleDock</string> + <string>PBXSmartGroupTreeModule</string> + <string>XCModuleDock</string> + <string>PBXNavigatorGroup</string> + <string>XCDetailModule</string> + </array> + <key>TableOfContents</key> + <array> + <string>AF88E9320FBA3EB400C5AA9C</string> + <string>1CE0B1FE06471DED0097A5F4</string> + <string>AF88E9330FBA3EB400C5AA9C</string> + <string>1CE0B20306471E060097A5F4</string> + <string>1CE0B20506471E060097A5F4</string> + </array> + <key>ToolbarConfigUserDefaultsMinorVersion</key> + <string>2</string> + <key>ToolbarConfiguration</key> + <string>xcode.toolbar.config.defaultV3</string> + </dict> + <dict> + <key>ControllerClassBaseName</key> + <string></string> + <key>IconName</key> + <string>WindowOfProject</string> + <key>Identifier</key> + <string>perspective.morph</string> + <key>IsVertical</key> + <integer>0</integer> + <key>Layout</key> + <array> + <dict> + <key>BecomeActive</key> + <integer>1</integer> + <key>ContentConfiguration</key> + <dict> + <key>PBXBottomSmartGroupGIDs</key> + <array> + <string>1C37FBAC04509CD000000102</string> + <string>1C37FAAC04509CD000000102</string> + <string>1C08E77C0454961000C914BD</string> + <string>1C37FABC05509CD000000102</string> + <string>1C37FABC05539CD112110102</string> + <string>E2644B35053B69B200211256</string> + <string>1C37FABC04509CD000100104</string> + <string>1CC0EA4004350EF90044410B</string> + <string>1CC0EA4004350EF90041110B</string> + </array> + <key>PBXProjectModuleGUID</key> + <string>11E0B1FE06471DED0097A5F4</string> + <key>PBXProjectModuleLabel</key> + <string>Files</string> + <key>PBXProjectStructureProvided</key> + <string>yes</string> + <key>PBXSmartGroupTreeModuleColumnData</key> + <dict> + <key>PBXSmartGroupTreeModuleColumnWidthsKey</key> + <array> + <real>186</real> + </array> + <key>PBXSmartGroupTreeModuleColumnsKey_v4</key> + <array> + <string>MainColumn</string> + </array> + </dict> + <key>PBXSmartGroupTreeModuleOutlineStateKey_v7</key> + <dict> + <key>PBXSmartGroupTreeModuleOutlineStateExpansionKey</key> + <array> + <string>29B97314FDCFA39411CA2CEA</string> + <string>1C37FABC05509CD000000102</string> + </array> + <key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key> + <array> + <array> + <integer>0</integer> + </array> + </array> + <key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key> + <string>{{0, 0}, {186, 337}}</string> + </dict> + <key>PBXTopSmartGroupGIDs</key> + <array/> + <key>XCIncludePerspectivesSwitch</key> + <integer>1</integer> + <key>XCSharingToken</key> + <string>com.apple.Xcode.GFSharingToken</string> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{{0, 0}, {203, 355}}</string> + <key>GroupTreeTableConfiguration</key> + <array> + <string>MainColumn</string> + <real>186</real> + </array> + <key>RubberWindowFrame</key> + <string>373 269 690 397 0 0 1440 878 </string> + </dict> + <key>Module</key> + <string>PBXSmartGroupTreeModule</string> + <key>Proportion</key> + <string>100%</string> + </dict> + </array> + <key>Name</key> + <string>Morph</string> + <key>PreferredWidth</key> + <integer>300</integer> + <key>ServiceClasses</key> + <array> + <string>XCModuleDock</string> + <string>PBXSmartGroupTreeModule</string> + </array> + <key>TableOfContents</key> + <array> + <string>11E0B1FE06471DED0097A5F4</string> + </array> + <key>ToolbarConfiguration</key> + <string>xcode.toolbar.config.default.shortV3</string> + </dict> + </array> + <key>PerspectivesBarVisible</key> + <false/> + <key>ShelfIsVisible</key> + <false/> + <key>SourceDescription</key> + <string>file at '/Developer/Library/PrivateFrameworks/DevToolsInterface.framework/Resources/XCPerspectivesSpecificationMode1.xcperspec'</string> + <key>StatusbarIsVisible</key> + <true/> + <key>TimeStamp</key> + <real>0.0</real> + <key>ToolbarConfigUserDefaultsMinorVersion</key> + <string>2</string> + <key>ToolbarDisplayMode</key> + <integer>1</integer> + <key>ToolbarIsVisible</key> + <true/> + <key>ToolbarSizeMode</key> + <integer>1</integer> + <key>Type</key> + <string>Perspectives</string> + <key>UpdateMessage</key> + <string>The Default Workspace in this version of Xcode now includes support to hide and show the detail view (what has been referred to as the "Metro-Morph" feature). You must discard your current Default Workspace settings and update to the latest Default Workspace in order to gain this feature. Do you wish to update to the latest Workspace defaults for project '%@'?</string> + <key>WindowJustification</key> + <integer>5</integer> + <key>WindowOrderList</key> + <array> + <string>AF88E9640FBA41D300C5AA9C</string> + <string>AF88E9650FBA41D300C5AA9C</string> + <string>1C78EAAD065D492600B07095</string> + <string>AF88E9420FBA3FD300C5AA9C</string> + <string>1CD10A99069EF8BA00B06720</string> + <string>/Volumes/Data/Users/cyrusdaboo/Documents/Development/Apple/eclipse/PyKerberos/support/PyKerberos.xcodeproj</string> + </array> + <key>WindowString</key> + <string>0 59 1920 1119 0 0 1920 1178 </string> + <key>WindowToolsV3</key> + <array> + <dict> + <key>FirstTimeWindowDisplayed</key> + <false/> + <key>Identifier</key> + <string>windowTool.build</string> + <key>IsVertical</key> + <true/> + <key>Layout</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>ContentConfiguration</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>1CD0528F0623707200166675</string> + <key>PBXProjectModuleLabel</key> + <string>kerberosbasic.c</string> + <key>StatusBarVisibility</key> + <true/> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{{0, 0}, {1344, 622}}</string> + <key>RubberWindowFrame</key> + <string>21 251 1344 904 0 0 1920 1178 </string> + </dict> + <key>Module</key> + <string>PBXNavigatorGroup</string> + <key>Proportion</key> + <string>622pt</string> + </dict> + <dict> + <key>BecomeActive</key> + <true/> + <key>ContentConfiguration</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>XCMainBuildResultsModuleGUID</string> + <key>PBXProjectModuleLabel</key> + <string>Build Results</string> + <key>XCBuildResultsTrigger_Collapse</key> + <integer>1021</integer> + <key>XCBuildResultsTrigger_Open</key> + <integer>1011</integer> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{{0, 627}, {1344, 236}}</string> + <key>RubberWindowFrame</key> + <string>21 251 1344 904 0 0 1920 1178 </string> + </dict> + <key>Module</key> + <string>PBXBuildResultsModule</string> + <key>Proportion</key> + <string>236pt</string> + </dict> + </array> + <key>Proportion</key> + <string>863pt</string> + </dict> + </array> + <key>Name</key> + <string>Build Results</string> + <key>ServiceClasses</key> + <array> + <string>PBXBuildResultsModule</string> + </array> + <key>StatusbarIsVisible</key> + <true/> + <key>TableOfContents</key> + <array> + <string>AF88E9420FBA3FD300C5AA9C</string> + <string>AF88E9430FBA3FD300C5AA9C</string> + <string>1CD0528F0623707200166675</string> + <string>XCMainBuildResultsModuleGUID</string> + </array> + <key>ToolbarConfiguration</key> + <string>xcode.toolbar.config.buildV3</string> + <key>WindowString</key> + <string>21 251 1344 904 0 0 1920 1178 </string> + <key>WindowToolGUID</key> + <string>AF88E9420FBA3FD300C5AA9C</string> + <key>WindowToolIsVisible</key> + <false/> + </dict> + <dict> + <key>FirstTimeWindowDisplayed</key> + <false/> + <key>Identifier</key> + <string>windowTool.debugger</string> + <key>IsVertical</key> + <true/> + <key>Layout</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>ContentConfiguration</key> + <dict> + <key>Debugger</key> + <dict> + <key>HorizontalSplitView</key> + <dict> + <key>_collapsingFrameDimension</key> + <real>0.0</real> + <key>_indexOfCollapsedView</key> + <integer>0</integer> + <key>_percentageOfCollapsedView</key> + <real>0.0</real> + <key>isCollapsed</key> + <string>yes</string> + <key>sizes</key> + <array> + <string>{{0, 0}, {733, 484}}</string> + <string>{{733, 0}, {877, 484}}</string> + </array> + </dict> + <key>VerticalSplitView</key> + <dict> + <key>_collapsingFrameDimension</key> + <real>0.0</real> + <key>_indexOfCollapsedView</key> + <integer>0</integer> + <key>_percentageOfCollapsedView</key> + <real>0.0</real> + <key>isCollapsed</key> + <string>yes</string> + <key>sizes</key> + <array> + <string>{{0, 0}, {1610, 484}}</string> + <string>{{0, 484}, {1610, 512}}</string> + </array> + </dict> + </dict> + <key>LauncherConfigVersion</key> + <string>8</string> + <key>PBXProjectModuleGUID</key> + <string>1C162984064C10D400B95A72</string> + <key>PBXProjectModuleLabel</key> + <string>Debug - GLUTExamples (Underwater)</string> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>DebugConsoleVisible</key> + <string>None</string> + <key>DebugConsoleWindowFrame</key> + <string>{{200, 200}, {500, 300}}</string> + <key>DebugSTDIOWindowFrame</key> + <string>{{200, 200}, {500, 300}}</string> + <key>Frame</key> + <string>{{0, 0}, {1610, 996}}</string> + <key>PBXDebugSessionStackFrameViewKey</key> + <dict> + <key>DebugVariablesTableConfiguration</key> + <array> + <string>Name</string> + <real>120</real> + <string>Value</string> + <real>85</real> + <string>Summary</string> + <real>647</real> + </array> + <key>Frame</key> + <string>{{733, 0}, {877, 484}}</string> + <key>RubberWindowFrame</key> + <string>21 118 1610 1037 0 0 1920 1178 </string> + </dict> + <key>RubberWindowFrame</key> + <string>21 118 1610 1037 0 0 1920 1178 </string> + </dict> + <key>Module</key> + <string>PBXDebugSessionModule</string> + <key>Proportion</key> + <string>996pt</string> + </dict> + </array> + <key>Proportion</key> + <string>996pt</string> + </dict> + </array> + <key>Name</key> + <string>Debugger</string> + <key>ServiceClasses</key> + <array> + <string>PBXDebugSessionModule</string> + </array> + <key>StatusbarIsVisible</key> + <true/> + <key>TableOfContents</key> + <array> + <string>1CD10A99069EF8BA00B06720</string> + <string>AF88E9350FBA3EB400C5AA9C</string> + <string>1C162984064C10D400B95A72</string> + <string>AF88E9360FBA3EB400C5AA9C</string> + <string>AF88E9370FBA3EB400C5AA9C</string> + <string>AF88E9380FBA3EB400C5AA9C</string> + <string>AF88E9390FBA3EB400C5AA9C</string> + <string>AF88E93A0FBA3EB400C5AA9C</string> + </array> + <key>ToolbarConfiguration</key> + <string>xcode.toolbar.config.debugV3</string> + <key>WindowString</key> + <string>21 118 1610 1037 0 0 1920 1178 </string> + <key>WindowToolGUID</key> + <string>1CD10A99069EF8BA00B06720</string> + <key>WindowToolIsVisible</key> + <false/> + </dict> + <dict> + <key>Identifier</key> + <string>windowTool.find</string> + <key>Layout</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>ContentConfiguration</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>1CDD528C0622207200134675</string> + <key>PBXProjectModuleLabel</key> + <string>&lt;No Editor&gt;</string> + <key>PBXSplitModuleInNavigatorKey</key> + <dict> + <key>Split0</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>1CD0528D0623707200166675</string> + </dict> + <key>SplitCount</key> + <string>1</string> + </dict> + <key>StatusBarVisibility</key> + <integer>1</integer> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{{0, 0}, {781, 167}}</string> + <key>RubberWindowFrame</key> + <string>62 385 781 470 0 0 1440 878 </string> + </dict> + <key>Module</key> + <string>PBXNavigatorGroup</string> + <key>Proportion</key> + <string>781pt</string> + </dict> + </array> + <key>Proportion</key> + <string>50%</string> + </dict> + <dict> + <key>BecomeActive</key> + <integer>1</integer> + <key>ContentConfiguration</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>1CD0528E0623707200166675</string> + <key>PBXProjectModuleLabel</key> + <string>Project Find</string> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{{8, 0}, {773, 254}}</string> + <key>RubberWindowFrame</key> + <string>62 385 781 470 0 0 1440 878 </string> + </dict> + <key>Module</key> + <string>PBXProjectFindModule</string> + <key>Proportion</key> + <string>50%</string> + </dict> + </array> + <key>Proportion</key> + <string>428pt</string> + </dict> + </array> + <key>Name</key> + <string>Project Find</string> + <key>ServiceClasses</key> + <array> + <string>PBXProjectFindModule</string> + </array> + <key>StatusbarIsVisible</key> + <integer>1</integer> + <key>TableOfContents</key> + <array> + <string>1C530D57069F1CE1000CFCEE</string> + <string>1C530D58069F1CE1000CFCEE</string> + <string>1C530D59069F1CE1000CFCEE</string> + <string>1CDD528C0622207200134675</string> + <string>1C530D5A069F1CE1000CFCEE</string> + <string>1CE0B1FE06471DED0097A5F4</string> + <string>1CD0528E0623707200166675</string> + </array> + <key>WindowString</key> + <string>62 385 781 470 0 0 1440 878 </string> + <key>WindowToolGUID</key> + <string>1C530D57069F1CE1000CFCEE</string> + <key>WindowToolIsVisible</key> + <integer>0</integer> + </dict> + <dict> + <key>Identifier</key> + <string>MENUSEPARATOR</string> + </dict> + <dict> + <key>FirstTimeWindowDisplayed</key> + <false/> + <key>Identifier</key> + <string>windowTool.debuggerConsole</string> + <key>IsVertical</key> + <true/> + <key>Layout</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>ContentConfiguration</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>1C78EAAC065D492600B07095</string> + <key>PBXProjectModuleLabel</key> + <string>Debugger Console</string> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{{0, 0}, {650, 209}}</string> + <key>RubberWindowFrame</key> + <string>21 905 650 250 0 0 1920 1178 </string> + </dict> + <key>Module</key> + <string>PBXDebugCLIModule</string> + <key>Proportion</key> + <string>209pt</string> + </dict> + </array> + <key>Proportion</key> + <string>209pt</string> + </dict> + </array> + <key>Name</key> + <string>Debugger Console</string> + <key>ServiceClasses</key> + <array> + <string>PBXDebugCLIModule</string> + </array> + <key>StatusbarIsVisible</key> + <true/> + <key>TableOfContents</key> + <array> + <string>1C78EAAD065D492600B07095</string> + <string>AF88E9570FBA419E00C5AA9C</string> + <string>1C78EAAC065D492600B07095</string> + </array> + <key>ToolbarConfiguration</key> + <string>xcode.toolbar.config.consoleV3</string> + <key>WindowString</key> + <string>21 905 650 250 0 0 1920 1178 </string> + <key>WindowToolGUID</key> + <string>1C78EAAD065D492600B07095</string> + <key>WindowToolIsVisible</key> + <false/> + </dict> + <dict> + <key>Identifier</key> + <string>windowTool.snapshots</string> + <key>Layout</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>Module</key> + <string>XCSnapshotModule</string> + <key>Proportion</key> + <string>100%</string> + </dict> + </array> + <key>Proportion</key> + <string>100%</string> + </dict> + </array> + <key>Name</key> + <string>Snapshots</string> + <key>ServiceClasses</key> + <array> + <string>XCSnapshotModule</string> + </array> + <key>StatusbarIsVisible</key> + <string>Yes</string> + <key>ToolbarConfiguration</key> + <string>xcode.toolbar.config.snapshots</string> + <key>WindowString</key> + <string>315 824 300 550 0 0 1440 878 </string> + <key>WindowToolIsVisible</key> + <string>Yes</string> + </dict> + <dict> + <key>Identifier</key> + <string>windowTool.scm</string> + <key>Layout</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>ContentConfiguration</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>1C78EAB2065D492600B07095</string> + <key>PBXProjectModuleLabel</key> + <string>&lt;No Editor&gt;</string> + <key>PBXSplitModuleInNavigatorKey</key> + <dict> + <key>Split0</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>1C78EAB3065D492600B07095</string> + </dict> + <key>SplitCount</key> + <string>1</string> + </dict> + <key>StatusBarVisibility</key> + <integer>1</integer> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{{0, 0}, {452, 0}}</string> + <key>RubberWindowFrame</key> + <string>743 379 452 308 0 0 1280 1002 </string> + </dict> + <key>Module</key> + <string>PBXNavigatorGroup</string> + <key>Proportion</key> + <string>0pt</string> + </dict> + <dict> + <key>BecomeActive</key> + <integer>1</integer> + <key>ContentConfiguration</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>1CD052920623707200166675</string> + <key>PBXProjectModuleLabel</key> + <string>SCM</string> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>ConsoleFrame</key> + <string>{{0, 259}, {452, 0}}</string> + <key>Frame</key> + <string>{{0, 7}, {452, 259}}</string> + <key>RubberWindowFrame</key> + <string>743 379 452 308 0 0 1280 1002 </string> + <key>TableConfiguration</key> + <array> + <string>Status</string> + <real>30</real> + <string>FileName</string> + <real>199</real> + <string>Path</string> + <real>197.0950012207031</real> + </array> + <key>TableFrame</key> + <string>{{0, 0}, {452, 250}}</string> + </dict> + <key>Module</key> + <string>PBXCVSModule</string> + <key>Proportion</key> + <string>262pt</string> + </dict> + </array> + <key>Proportion</key> + <string>266pt</string> + </dict> + </array> + <key>Name</key> + <string>SCM</string> + <key>ServiceClasses</key> + <array> + <string>PBXCVSModule</string> + </array> + <key>StatusbarIsVisible</key> + <integer>1</integer> + <key>TableOfContents</key> + <array> + <string>1C78EAB4065D492600B07095</string> + <string>1C78EAB5065D492600B07095</string> + <string>1C78EAB2065D492600B07095</string> + <string>1CD052920623707200166675</string> + </array> + <key>ToolbarConfiguration</key> + <string>xcode.toolbar.config.scm</string> + <key>WindowString</key> + <string>743 379 452 308 0 0 1280 1002 </string> + </dict> + <dict> + <key>Identifier</key> + <string>windowTool.breakpoints</string> + <key>IsVertical</key> + <integer>0</integer> + <key>Layout</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>BecomeActive</key> + <integer>1</integer> + <key>ContentConfiguration</key> + <dict> + <key>PBXBottomSmartGroupGIDs</key> + <array> + <string>1C77FABC04509CD000000102</string> + </array> + <key>PBXProjectModuleGUID</key> + <string>1CE0B1FE06471DED0097A5F4</string> + <key>PBXProjectModuleLabel</key> + <string>Files</string> + <key>PBXProjectStructureProvided</key> + <string>no</string> + <key>PBXSmartGroupTreeModuleColumnData</key> + <dict> + <key>PBXSmartGroupTreeModuleColumnWidthsKey</key> + <array> + <real>168</real> + </array> + <key>PBXSmartGroupTreeModuleColumnsKey_v4</key> + <array> + <string>MainColumn</string> + </array> + </dict> + <key>PBXSmartGroupTreeModuleOutlineStateKey_v7</key> + <dict> + <key>PBXSmartGroupTreeModuleOutlineStateExpansionKey</key> + <array> + <string>1C77FABC04509CD000000102</string> + </array> + <key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key> + <array> + <array> + <integer>0</integer> + </array> + </array> + <key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key> + <string>{{0, 0}, {168, 350}}</string> + </dict> + <key>PBXTopSmartGroupGIDs</key> + <array/> + <key>XCIncludePerspectivesSwitch</key> + <integer>0</integer> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{{0, 0}, {185, 368}}</string> + <key>GroupTreeTableConfiguration</key> + <array> + <string>MainColumn</string> + <real>168</real> + </array> + <key>RubberWindowFrame</key> + <string>315 424 744 409 0 0 1440 878 </string> + </dict> + <key>Module</key> + <string>PBXSmartGroupTreeModule</string> + <key>Proportion</key> + <string>185pt</string> + </dict> + <dict> + <key>ContentConfiguration</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>1CA1AED706398EBD00589147</string> + <key>PBXProjectModuleLabel</key> + <string>Detail</string> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{{190, 0}, {554, 368}}</string> + <key>RubberWindowFrame</key> + <string>315 424 744 409 0 0 1440 878 </string> + </dict> + <key>Module</key> + <string>XCDetailModule</string> + <key>Proportion</key> + <string>554pt</string> + </dict> + </array> + <key>Proportion</key> + <string>368pt</string> + </dict> + </array> + <key>MajorVersion</key> + <integer>3</integer> + <key>MinorVersion</key> + <integer>0</integer> + <key>Name</key> + <string>Breakpoints</string> + <key>ServiceClasses</key> + <array> + <string>PBXSmartGroupTreeModule</string> + <string>XCDetailModule</string> + </array> + <key>StatusbarIsVisible</key> + <integer>1</integer> + <key>TableOfContents</key> + <array> + <string>1CDDB66807F98D9800BB5817</string> + <string>1CDDB66907F98D9800BB5817</string> + <string>1CE0B1FE06471DED0097A5F4</string> + <string>1CA1AED706398EBD00589147</string> + </array> + <key>ToolbarConfiguration</key> + <string>xcode.toolbar.config.breakpointsV3</string> + <key>WindowString</key> + <string>315 424 744 409 0 0 1440 878 </string> + <key>WindowToolGUID</key> + <string>1CDDB66807F98D9800BB5817</string> + <key>WindowToolIsVisible</key> + <integer>1</integer> + </dict> + <dict> + <key>Identifier</key> + <string>windowTool.debugAnimator</string> + <key>Layout</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>Module</key> + <string>PBXNavigatorGroup</string> + <key>Proportion</key> + <string>100%</string> + </dict> + </array> + <key>Proportion</key> + <string>100%</string> + </dict> + </array> + <key>Name</key> + <string>Debug Visualizer</string> + <key>ServiceClasses</key> + <array> + <string>PBXNavigatorGroup</string> + </array> + <key>StatusbarIsVisible</key> + <integer>1</integer> + <key>ToolbarConfiguration</key> + <string>xcode.toolbar.config.debugAnimatorV3</string> + <key>WindowString</key> + <string>100 100 700 500 0 0 1280 1002 </string> + </dict> + <dict> + <key>Identifier</key> + <string>windowTool.bookmarks</string> + <key>Layout</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>Module</key> + <string>PBXBookmarksModule</string> + <key>Proportion</key> + <string>100%</string> + </dict> + </array> + <key>Proportion</key> + <string>100%</string> + </dict> + </array> + <key>Name</key> + <string>Bookmarks</string> + <key>ServiceClasses</key> + <array> + <string>PBXBookmarksModule</string> + </array> + <key>StatusbarIsVisible</key> + <integer>0</integer> + <key>WindowString</key> + <string>538 42 401 187 0 0 1280 1002 </string> + </dict> + <dict> + <key>Identifier</key> + <string>windowTool.projectFormatConflicts</string> + <key>Layout</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>Module</key> + <string>XCProjectFormatConflictsModule</string> + <key>Proportion</key> + <string>100%</string> + </dict> + </array> + <key>Proportion</key> + <string>100%</string> + </dict> + </array> + <key>Name</key> + <string>Project Format Conflicts</string> + <key>ServiceClasses</key> + <array> + <string>XCProjectFormatConflictsModule</string> + </array> + <key>StatusbarIsVisible</key> + <integer>0</integer> + <key>WindowContentMinSize</key> + <string>450 300</string> + <key>WindowString</key> + <string>50 850 472 307 0 0 1440 877</string> + </dict> + <dict> + <key>Identifier</key> + <string>windowTool.classBrowser</string> + <key>Layout</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>BecomeActive</key> + <integer>1</integer> + <key>ContentConfiguration</key> + <dict> + <key>OptionsSetName</key> + <string>Hierarchy, all classes</string> + <key>PBXProjectModuleGUID</key> + <string>1CA6456E063B45B4001379D8</string> + <key>PBXProjectModuleLabel</key> + <string>Class Browser - NSObject</string> + </dict> + <key>GeometryConfiguration</key> + <dict> + <key>ClassesFrame</key> + <string>{{0, 0}, {374, 96}}</string> + <key>ClassesTreeTableConfiguration</key> + <array> + <string>PBXClassNameColumnIdentifier</string> + <real>208</real> + <string>PBXClassBookColumnIdentifier</string> + <real>22</real> + </array> + <key>Frame</key> + <string>{{0, 0}, {630, 331}}</string> + <key>MembersFrame</key> + <string>{{0, 105}, {374, 395}}</string> + <key>MembersTreeTableConfiguration</key> + <array> + <string>PBXMemberTypeIconColumnIdentifier</string> + <real>22</real> + <string>PBXMemberNameColumnIdentifier</string> + <real>216</real> + <string>PBXMemberTypeColumnIdentifier</string> + <real>97</real> + <string>PBXMemberBookColumnIdentifier</string> + <real>22</real> + </array> + <key>PBXModuleWindowStatusBarHidden2</key> + <integer>1</integer> + <key>RubberWindowFrame</key> + <string>385 179 630 352 0 0 1440 878 </string> + </dict> + <key>Module</key> + <string>PBXClassBrowserModule</string> + <key>Proportion</key> + <string>332pt</string> + </dict> + </array> + <key>Proportion</key> + <string>332pt</string> + </dict> + </array> + <key>Name</key> + <string>Class Browser</string> + <key>ServiceClasses</key> + <array> + <string>PBXClassBrowserModule</string> + </array> + <key>StatusbarIsVisible</key> + <integer>0</integer> + <key>TableOfContents</key> + <array> + <string>1C0AD2AF069F1E9B00FABCE6</string> + <string>1C0AD2B0069F1E9B00FABCE6</string> + <string>1CA6456E063B45B4001379D8</string> + </array> + <key>ToolbarConfiguration</key> + <string>xcode.toolbar.config.classbrowser</string> + <key>WindowString</key> + <string>385 179 630 352 0 0 1440 878 </string> + <key>WindowToolGUID</key> + <string>1C0AD2AF069F1E9B00FABCE6</string> + <key>WindowToolIsVisible</key> + <integer>0</integer> + </dict> + <dict> + <key>Identifier</key> + <string>windowTool.refactoring</string> + <key>IncludeInToolsMenu</key> + <integer>0</integer> + <key>Layout</key> + <array> + <dict> + <key>Dock</key> + <array> + <dict> + <key>BecomeActive</key> + <integer>1</integer> + <key>GeometryConfiguration</key> + <dict> + <key>Frame</key> + <string>{0, 0}, {500, 335}</string> + <key>RubberWindowFrame</key> + <string>{0, 0}, {500, 335}</string> + </dict> + <key>Module</key> + <string>XCRefactoringModule</string> + <key>Proportion</key> + <string>100%</string> + </dict> + </array> + <key>Proportion</key> + <string>100%</string> + </dict> + </array> + <key>Name</key> + <string>Refactoring</string> + <key>ServiceClasses</key> + <array> + <string>XCRefactoringModule</string> + </array> + <key>WindowString</key> + <string>200 200 500 356 0 0 1920 1200 </string> + </dict> + </array> +</dict> +</plist> diff --git a/support/PyKerberos.xcodeproj/cyrusdaboo.pbxuser b/support/PyKerberos.xcodeproj/cyrusdaboo.pbxuser new file mode 100644 index 0000000..4b51fd8 --- /dev/null +++ b/support/PyKerberos.xcodeproj/cyrusdaboo.pbxuser @@ -0,0 +1,706 @@ +// !$*UTF8*$! +{ + 08FB7793FE84155DC02AAC07 /* Project object */ = { + activeBuildConfigurationName = Debug; + activeExecutable = AFDE37EE0BB41DF9008C037E /* PyKerberos */; + activeSDKPreference = macosx10.6; + activeTarget = 8DD76F620486A84900D96B5E /* PyKerberos */; + addToTargets = ( + 8DD76F620486A84900D96B5E /* PyKerberos */, + ); + breakpoints = ( + AF4480A50BB4292300408822 /* kerberosbasic.c:35 */, + AF4480C10BB42C1E00408822 /* kerberosbasic.c:92 */, + AF4480CD0BB42CFF00408822 /* main.c:23 */, + AF4480D80BB42D6100408822 /* kerberosgss.c:253 */, + ); + codeSenseManager = AFDE37F60BB41E00008C037E /* Code sense */; + executables = ( + AFDE37EE0BB41DF9008C037E /* PyKerberos */, + ); + perUserDictionary = { + PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = { + PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; + PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; + PBXFileTableDataSourceColumnWidthsKey = ( + 20, + 1384, + 20, + 48, + 43, + 43, + 20, + ); + PBXFileTableDataSourceColumnsKey = ( + PBXFileDataSource_FiletypeID, + PBXFileDataSource_Filename_ColumnID, + PBXFileDataSource_Built_ColumnID, + PBXFileDataSource_ObjectSize_ColumnID, + PBXFileDataSource_Errors_ColumnID, + PBXFileDataSource_Warnings_ColumnID, + PBXFileDataSource_Target_ColumnID, + ); + }; + PBXPerProjectTemplateStateSaveDate = 263863739; + PBXWorkspaceStateSaveDate = 263863739; + }; + perUserProjectItems = { + AF4480AD0BB42BFD00408822 = AF4480AD0BB42BFD00408822 /* PBXTextBookmark */; + AF4480AF0BB42BFD00408822 = AF4480AF0BB42BFD00408822 /* PBXTextBookmark */; + AF4480B00BB42BFD00408822 = AF4480B00BB42BFD00408822 /* PBXTextBookmark */; + AF4480CF0BB42D1700408822 = AF4480CF0BB42D1700408822 /* PBXTextBookmark */; + AF4480DF0BB42E3C00408822 = AF4480DF0BB42E3C00408822 /* PBXTextBookmark */; + AF88E92D0FBA3EB400C5AA9C /* PBXTextBookmark */ = AF88E92D0FBA3EB400C5AA9C /* PBXTextBookmark */; + AF88E92E0FBA3EB400C5AA9C /* PBXTextBookmark */ = AF88E92E0FBA3EB400C5AA9C /* PBXTextBookmark */; + AF88E9300FBA3EB400C5AA9C /* PBXTextBookmark */ = AF88E9300FBA3EB400C5AA9C /* PBXTextBookmark */; + AF88E9400FBA3FD300C5AA9C /* XCBuildMessageTextBookmark */ = AF88E9400FBA3FD300C5AA9C /* XCBuildMessageTextBookmark */; + AF88E9410FBA3FD300C5AA9C /* PBXTextBookmark */ = AF88E9410FBA3FD300C5AA9C /* PBXTextBookmark */; + AF88E94C0FBA407500C5AA9C /* PBXTextBookmark */ = AF88E94C0FBA407500C5AA9C /* PBXTextBookmark */; + AF88E9560FBA419E00C5AA9C /* PBXTextBookmark */ = AF88E9560FBA419E00C5AA9C /* PBXTextBookmark */; + AF88E95C0FBA41D300C5AA9C /* PBXTextBookmark */ = AF88E95C0FBA41D300C5AA9C /* PBXTextBookmark */; + AF88E95D0FBA41D300C5AA9C /* PBXTextBookmark */ = AF88E95D0FBA41D300C5AA9C /* PBXTextBookmark */; + AF88E95E0FBA41D300C5AA9C /* PBXTextBookmark */ = AF88E95E0FBA41D300C5AA9C /* PBXTextBookmark */; + AF88E95F0FBA41D300C5AA9C /* PBXTextBookmark */ = AF88E95F0FBA41D300C5AA9C /* PBXTextBookmark */; + AF88E9600FBA41D300C5AA9C /* PBXTextBookmark */ = AF88E9600FBA41D300C5AA9C /* PBXTextBookmark */; + AF88E9610FBA41D300C5AA9C /* PBXTextBookmark */ = AF88E9610FBA41D300C5AA9C /* PBXTextBookmark */; + AF88E9620FBA41D300C5AA9C /* PBXTextBookmark */ = AF88E9620FBA41D300C5AA9C /* PBXTextBookmark */; + AF88E9630FBA41D300C5AA9C /* PBXTextBookmark */ = AF88E9630FBA41D300C5AA9C /* PBXTextBookmark */; + AF88E9660FBA435000C5AA9C /* PBXTextBookmark */ = AF88E9660FBA435000C5AA9C /* PBXTextBookmark */; + AF88E9670FBA435000C5AA9C /* PBXTextBookmark */ = AF88E9670FBA435000C5AA9C /* PBXTextBookmark */; + AF88E9680FBA435000C5AA9C /* PBXTextBookmark */ = AF88E9680FBA435000C5AA9C /* PBXTextBookmark */; + AF88E9690FBA435000C5AA9C /* PBXTextBookmark */ = AF88E9690FBA435000C5AA9C /* PBXTextBookmark */; + AF88E96A0FBA435000C5AA9C /* PBXTextBookmark */ = AF88E96A0FBA435000C5AA9C /* PBXTextBookmark */; + AF88E96B0FBA435000C5AA9C /* PBXTextBookmark */ = AF88E96B0FBA435000C5AA9C /* PBXTextBookmark */; + AF88E96C0FBA438E00C5AA9C /* PBXTextBookmark */ = AF88E96C0FBA438E00C5AA9C /* PBXTextBookmark */; + AF88E96D0FBA43A100C5AA9C /* PBXTextBookmark */ = AF88E96D0FBA43A100C5AA9C /* PBXTextBookmark */; + AF88E96E0FBA43B300C5AA9C /* PBXTextBookmark */ = AF88E96E0FBA43B300C5AA9C /* PBXTextBookmark */; + AF88E96F0FBA43D100C5AA9C /* PBXTextBookmark */ = AF88E96F0FBA43D100C5AA9C /* PBXTextBookmark */; + AF88E9700FBA441100C5AA9C /* PBXTextBookmark */ = AF88E9700FBA441100C5AA9C /* PBXTextBookmark */; + AF88E9710FBA441B00C5AA9C /* PBXTextBookmark */ = AF88E9710FBA441B00C5AA9C /* PBXTextBookmark */; + AF88E9720FBA442300C5AA9C /* PBXTextBookmark */ = AF88E9720FBA442300C5AA9C /* PBXTextBookmark */; + AF88E9730FBA443200C5AA9C /* PBXTextBookmark */ = AF88E9730FBA443200C5AA9C /* PBXTextBookmark */; + AF88E97A0FBA449500C5AA9C /* PBXTextBookmark */ = AF88E97A0FBA449500C5AA9C /* PBXTextBookmark */; + AF88E97B0FBA449500C5AA9C /* PBXTextBookmark */ = AF88E97B0FBA449500C5AA9C /* PBXTextBookmark */; + AFDE38700BB420B1008C037E = AFDE38700BB420B1008C037E /* PBXTextBookmark */; + AFDE38870BB42287008C037E = AFDE38870BB42287008C037E /* PBXTextBookmark */; + AFDE388A0BB42287008C037E = AFDE388A0BB42287008C037E /* PBXTextBookmark */; + AFDE388E0BB42287008C037E = AFDE388E0BB42287008C037E /* PBXTextBookmark */; + }; + sourceControlManager = AFDE37F50BB41E00008C037E /* Source Control */; + userBuildSettings = { + }; + }; + 08FB7796FE84155DC02AAC07 /* main.c */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1562, 616}}"; + sepNavSelRange = "{1055, 0}"; + sepNavVisRange = "{0, 1131}"; + sepNavVisRect = "{{0, 0}, {984, 308}}"; + sepNavWindowFrame = "{{485, -20}, {1395, 1160}}"; + }; + }; + 8DD76F620486A84900D96B5E /* PyKerberos */ = { + activeExec = 0; + executables = ( + AFDE37EE0BB41DF9008C037E /* PyKerberos */, + ); + }; + AF4480A50BB4292300408822 /* kerberosbasic.c:35 */ = { + isa = PBXFileBreakpoint; + actions = ( + ); + breakpointStyle = 0; + continueAfterActions = 0; + countType = 0; + delayBeforeContinue = 0; + fileReference = AFDE37FA0BB41E1D008C037E /* kerberosbasic.c */; + functionName = "authenticate_user_krb5pwd(const char *user, const char *pswd, const char *service, const char *default_realm)"; + hitCount = 0; + ignoreCount = 0; + lineNumber = 35; + location = PyKerberos; + modificationTime = 263864776.548559; + originalNumberOfMultipleMatches = 1; + state = 1; + }; + AF4480AD0BB42BFD00408822 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE37FC0BB41E1D008C037E /* kerberosgss.c */; + name = "kerberosgss.c: 47"; + rLen = 0; + rLoc = 1293; + rType = 0; + vrLen = 930; + vrLoc = 867; + }; + AF4480AF0BB42BFD00408822 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 08FB7796FE84155DC02AAC07 /* main.c */; + name = "main.c: 4"; + rLen = 0; + rLoc = 45; + rType = 0; + vrLen = 405; + vrLoc = 0; + }; + AF4480B00BB42BFD00408822 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE37FC0BB41E1D008C037E /* kerberosgss.c */; + name = "kerberosgss.c: 47"; + rLen = 0; + rLoc = 1293; + rType = 0; + vrLen = 930; + vrLoc = 867; + }; + AF4480C10BB42C1E00408822 /* kerberosbasic.c:92 */ = { + isa = PBXFileBreakpoint; + actions = ( + ); + breakpointStyle = 0; + continueAfterActions = 0; + countType = 0; + delayBeforeContinue = 0; + fileReference = AFDE37FA0BB41E1D008C037E /* kerberosbasic.c */; + functionName = "authenticate_user_krb5pwd(const char *user, const char *pswd, const char *service, const char *default_realm)"; + hitCount = 0; + ignoreCount = 0; + lineNumber = 92; + location = PyKerberos; + modificationTime = 263864776.583793; + originalNumberOfMultipleMatches = 1; + state = 1; + }; + AF4480CD0BB42CFF00408822 /* main.c:23 */ = { + isa = PBXFileBreakpoint; + actions = ( + ); + breakpointStyle = 0; + continueAfterActions = 0; + countType = 0; + delayBeforeContinue = 0; + fileReference = 08FB7796FE84155DC02AAC07 /* main.c */; + functionName = "main()"; + hitCount = 1; + ignoreCount = 0; + lineNumber = 23; + location = PyKerberos; + modificationTime = 263864776.766891; + originalNumberOfMultipleMatches = 1; + state = 1; + }; + AF4480CF0BB42D1700408822 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + comments = "error: syntax error before 'gss_server_state'"; + fRef = 08FB7796FE84155DC02AAC07 /* main.c */; + rLen = 1; + rLoc = 17; + rType = 1; + }; + AF4480D80BB42D6100408822 /* kerberosgss.c:253 */ = { + isa = PBXFileBreakpoint; + actions = ( + ); + breakpointStyle = 0; + continueAfterActions = 0; + countType = 0; + delayBeforeContinue = 0; + fileReference = AFDE37FC0BB41E1D008C037E /* kerberosgss.c */; + functionName = "authenticate_gss_server_init(const char* service, gss_server_state *state)"; + hitCount = 0; + ignoreCount = 0; + lineNumber = 253; + location = PyKerberos; + modificationTime = 263864776.633991; + originalNumberOfMultipleMatches = 1; + state = 1; + }; + AF4480DF0BB42E3C00408822 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 08FB7796FE84155DC02AAC07 /* main.c */; + name = "main.c: 18"; + rLen = 0; + rLoc = 511; + rType = 0; + vrLen = 584; + vrLoc = 0; + }; + AF88E92D0FBA3EB400C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE37FC0BB41E1D008C037E /* kerberosgss.c */; + name = "kerberosgss.c: 498"; + rLen = 0; + rLoc = 15211; + rType = 0; + vrLen = 1613; + vrLoc = 12775; + }; + AF88E92E0FBA3EB400C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AF88E92F0FBA3EB400C5AA9C /* gssapi.h */; + rLen = 1; + rLoc = 203; + rType = 1; + }; + AF88E92F0FBA3EB400C5AA9C /* gssapi.h */ = { + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = gssapi.h; + path = /Developer/SDKs/MacOSX10.5.sdk/usr/include/gssapi/gssapi.h; + sourceTree = "<absolute>"; + }; + AF88E9300FBA3EB400C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AF88E9310FBA3EB400C5AA9C /* gssapi.h */; + name = "gssapi.h: 204"; + rLen = 48; + rLoc = 5223; + rType = 0; + vrLen = 1593; + vrLoc = 4463; + }; + AF88E9310FBA3EB400C5AA9C /* gssapi.h */ = { + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = gssapi.h; + path = /Developer/SDKs/MacOSX10.5.sdk/usr/include/gssapi/gssapi.h; + sourceTree = "<absolute>"; + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1651, 10504}}"; + sepNavSelRange = "{18918, 19}"; + sepNavVisRange = "{18293, 1476}"; + }; + }; + AF88E9400FBA3FD300C5AA9C /* XCBuildMessageTextBookmark */ = { + isa = XCBuildMessageTextBookmark; + comments = "Python.h: No such file or directory"; + fRef = AFDE37FA0BB41E1D008C037E /* kerberosbasic.c */; + rLen = 1; + rLoc = 16; + rType = 1; + }; + AF88E9410FBA3FD300C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE37FA0BB41E1D008C037E /* kerberosbasic.c */; + name = "kerberosbasic.c: 17"; + rLen = 0; + rLoc = 627; + rType = 0; + vrLen = 450; + vrLoc = 300; + }; + AF88E94C0FBA407500C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE37FA0BB41E1D008C037E /* kerberosbasic.c */; + name = "kerberosbasic.c: 17"; + rLen = 0; + rLoc = 627; + rType = 0; + vrLen = 1616; + vrLoc = 0; + }; + AF88E94E0FBA416E00C5AA9C /* kerberospw.c */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1562, 1781}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRange = "{0, 1509}"; + }; + }; + AF88E94F0FBA416E00C5AA9C /* kerberospw.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1562, 616}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRange = "{0, 867}"; + }; + }; + AF88E9560FBA419E00C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE37FA0BB41E1D008C037E /* kerberosbasic.c */; + name = "kerberosbasic.c: 17"; + rLen = 0; + rLoc = 627; + rType = 0; + vrLen = 1487; + vrLoc = 0; + }; + AF88E95C0FBA41D300C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE37FC0BB41E1D008C037E /* kerberosgss.c */; + name = "kerberosgss.c: 496"; + rLen = 22; + rLoc = 15065; + rType = 0; + vrLen = 1715; + vrLoc = 14638; + }; + AF88E95D0FBA41D300C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AF88E9310FBA3EB400C5AA9C /* gssapi.h */; + name = "gssapi.h: 585"; + rLen = 19; + rLoc = 18918; + rType = 0; + vrLen = 1476; + vrLoc = 18293; + }; + AF88E95E0FBA41D300C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE383A0BB41FFA008C037E /* kerberos.c */; + name = "kerberos.c: 39"; + rLen = 25; + rLoc = 1160; + rType = 0; + vrLen = 1124; + vrLoc = 992; + }; + AF88E95F0FBA41D300C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE37FA0BB41E1D008C037E /* kerberosbasic.c */; + name = "kerberosbasic.c: 27"; + rLen = 63; + rLoc = 806; + rType = 0; + vrLen = 1617; + vrLoc = 63; + }; + AF88E9600FBA41D300C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AF88E94F0FBA416E00C5AA9C /* kerberospw.h */; + name = "kerberospw.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 867; + vrLoc = 0; + }; + AF88E9610FBA41D300C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AF88E94E0FBA416E00C5AA9C /* kerberospw.c */; + name = "kerberospw.c: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1509; + vrLoc = 0; + }; + AF88E9620FBA41D300C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 08FB7796FE84155DC02AAC07 /* main.c */; + rLen = 0; + rLoc = 22; + rType = 1; + }; + AF88E9630FBA41D300C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 08FB7796FE84155DC02AAC07 /* main.c */; + name = "main.c: 33"; + rLen = 0; + rLoc = 1055; + rType = 0; + vrLen = 1131; + vrLoc = 0; + }; + AF88E9660FBA435000C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 08FB7796FE84155DC02AAC07 /* main.c */; + name = "main.c: 33"; + rLen = 0; + rLoc = 1055; + rType = 0; + vrLen = 1131; + vrLoc = 0; + }; + AF88E9670FBA435000C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE383A0BB41FFA008C037E /* kerberos.c */; + name = "kerberos.c: 415"; + rLen = 0; + rLoc = 11472; + rType = 0; + vrLen = 1178; + vrLoc = 7396; + }; + AF88E9680FBA435000C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE37FB0BB41E1D008C037E /* kerberosbasic.h */; + name = "kerberosbasic.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 898; + vrLoc = 0; + }; + AF88E9690FBA435000C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE37FD0BB41E1D008C037E /* kerberosgss.h */; + name = "kerberosgss.h: 46"; + rLen = 0; + rLoc = 1419; + rType = 0; + vrLen = 1615; + vrLoc = 587; + }; + AF88E96A0FBA435000C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE37FC0BB41E1D008C037E /* kerberosgss.c */; + name = "kerberosgss.c: 496"; + rLen = 22; + rLoc = 15065; + rType = 0; + vrLen = 1710; + vrLoc = 14638; + }; + AF88E96B0FBA435000C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE37FC0BB41E1D008C037E /* kerberosgss.c */; + name = "kerberosgss.c: 539"; + rLen = 0; + rLoc = 17377; + rType = 0; + vrLen = 1293; + vrLoc = 15634; + }; + AF88E96C0FBA438E00C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE37FC0BB41E1D008C037E /* kerberosgss.c */; + name = "kerberosgss.c: 543"; + rLen = 19; + rLoc = 16673; + rType = 0; + vrLen = 1714; + vrLoc = 15772; + }; + AF88E96D0FBA43A100C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE37FC0BB41E1D008C037E /* kerberosgss.c */; + name = "kerberosgss.c: 543"; + rLen = 0; + rLoc = 16692; + rType = 0; + vrLen = 1563; + vrLoc = 15772; + }; + AF88E96E0FBA43B300C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE37FC0BB41E1D008C037E /* kerberosgss.c */; + name = "kerberosgss.c: 543"; + rLen = 0; + rLoc = 16718; + rType = 0; + vrLen = 1588; + vrLoc = 15777; + }; + AF88E96F0FBA43D100C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE37FC0BB41E1D008C037E /* kerberosgss.c */; + name = "kerberosgss.c: 543"; + rLen = 0; + rLoc = 16726; + rType = 0; + vrLen = 1594; + vrLoc = 15777; + }; + AF88E9700FBA441100C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE37FC0BB41E1D008C037E /* kerberosgss.c */; + name = "kerberosgss.c: 544"; + rLen = 0; + rLoc = 16738; + rType = 0; + vrLen = 1483; + vrLoc = 16048; + }; + AF88E9710FBA441B00C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE37FC0BB41E1D008C037E /* kerberosgss.c */; + name = "kerberosgss.c: 544"; + rLen = 0; + rLoc = 16768; + rType = 0; + vrLen = 1484; + vrLoc = 16048; + }; + AF88E9720FBA442300C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE37FC0BB41E1D008C037E /* kerberosgss.c */; + name = "kerberosgss.c: 544"; + rLen = 0; + rLoc = 16768; + rType = 0; + vrLen = 1491; + vrLoc = 16048; + }; + AF88E9730FBA443200C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE37FC0BB41E1D008C037E /* kerberosgss.c */; + name = "kerberosgss.c: 544"; + rLen = 0; + rLoc = 16768; + rType = 0; + vrLen = 1503; + vrLoc = 16048; + }; + AF88E97A0FBA449500C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE37FC0BB41E1D008C037E /* kerberosgss.c */; + name = "kerberosgss.c: 529"; + rLen = 16; + rLoc = 16093; + rType = 0; + vrLen = 1576; + vrLoc = 15766; + }; + AF88E97B0FBA449500C5AA9C /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE37FC0BB41E1D008C037E /* kerberosgss.c */; + name = "kerberosgss.c: 551"; + rLen = 0; + rLoc = 16985; + rType = 0; + vrLen = 1596; + vrLoc = 16048; + }; + AFDE37EE0BB41DF9008C037E /* PyKerberos */ = { + isa = PBXExecutable; + activeArgIndices = ( + ); + argumentStrings = ( + ); + autoAttachOnCrash = 1; + breakpointsEnabled = 1; + configStateDict = { + }; + customDataFormattersEnabled = 1; + dataTipCustomDataFormattersEnabled = 1; + dataTipShowTypeColumn = 1; + dataTipSortType = 0; + debuggerPlugin = GDBDebugging; + disassemblyDisplayState = 0; + dylibVariantSuffix = ""; + enableDebugStr = 1; + environmentEntries = ( + ); + executableSystemSymbolLevel = 0; + executableUserSymbolLevel = 0; + libgmallocEnabled = 0; + name = PyKerberos; + savedGlobals = { + }; + showTypeColumn = 0; + sourceDirectories = ( + ); + variableFormatDictionary = { + }; + }; + AFDE37F50BB41E00008C037E /* Source Control */ = { + isa = PBXSourceControlManager; + fallbackIsa = XCSourceControlManager; + isSCMEnabled = 0; + repositoryNamesForRoots = { + }; + scmConfiguration = { + repositoryNamesForRoots = { + }; + }; + }; + AFDE37F60BB41E00008C037E /* Code sense */ = { + isa = PBXCodeSenseManager; + indexTemplatePath = ""; + }; + AFDE37F80BB41E1D008C037E /* base64.c */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {991, 1316}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 437}, {991, 524}}"; + }; + }; + AFDE37FA0BB41E1D008C037E /* kerberosbasic.c */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1283, 1846}}"; + sepNavSelRange = "{627, 0}"; + sepNavVisRange = "{0, 1616}"; + sepNavVisRect = "{{0, 325}, {984, 316}}"; + }; + }; + AFDE37FB0BB41E1D008C037E /* kerberosbasic.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1562, 616}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRange = "{0, 898}"; + sepNavVisRect = "{{0, 0}, {1336, 1031}}"; + sepNavWindowFrame = "{{15, 13}, {1395, 1160}}"; + }; + }; + AFDE37FC0BB41E1D008C037E /* kerberosgss.c */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1562, 7969}}"; + sepNavSelRange = "{16985, 0}"; + sepNavVisRange = "{16048, 1596}"; + sepNavVisRect = "{{0, 2485}, {984, 308}}"; + }; + }; + AFDE37FD0BB41E1D008C037E /* kerberosgss.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1562, 793}}"; + sepNavSelRange = "{1419, 0}"; + sepNavVisRange = "{587, 1615}"; + sepNavVisRect = "{{0, 0}, {1336, 1031}}"; + sepNavWindowFrame = "{{15, 13}, {1395, 1160}}"; + }; + }; + AFDE383A0BB41FFA008C037E /* kerberos.c */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1562, 5733}}"; + sepNavSelRange = "{11472, 0}"; + sepNavVisRange = "{7396, 1178}"; + sepNavVisRect = "{{0, 0}, {932, 292}}"; + }; + }; + AFDE38700BB420B1008C037E /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 08FB7796FE84155DC02AAC07 /* main.c */; + name = "main.cpp: 9"; + rLen = 0; + rLoc = 155; + rType = 0; + vrLen = 249; + vrLoc = 0; + }; + AFDE38720BB420B1008C037E /* iostream */ = { + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.h; + name = iostream; + path = "/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/iostream"; + sourceTree = "<absolute>"; + }; + AFDE38870BB42287008C037E /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE38720BB420B1008C037E /* iostream */; + name = "iostream: 76"; + rLen = 0; + rLoc = 2873; + rType = 0; + vrLen = 1307; + vrLoc = 1651; + }; + AFDE388A0BB42287008C037E /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE38720BB420B1008C037E /* iostream */; + name = "iostream: 76"; + rLen = 0; + rLoc = 2873; + rType = 0; + vrLen = 1307; + vrLoc = 1651; + }; + AFDE388E0BB42287008C037E /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = AFDE37FC0BB41E1D008C037E /* kerberosgss.c */; + name = "kerberosgss.c: 47"; + rLen = 0; + rLoc = 1298; + rType = 0; + vrLen = 1144; + vrLoc = 1097; + }; +} diff --git a/support/PyKerberos.xcodeproj/project.pbxproj b/support/PyKerberos.xcodeproj/project.pbxproj new file mode 100644 index 0000000..90ffc03 --- /dev/null +++ b/support/PyKerberos.xcodeproj/project.pbxproj @@ -0,0 +1,252 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 44; + objects = { + +/* Begin PBXBuildFile section */ + 8DD76F650486A84900D96B5E /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 08FB7796FE84155DC02AAC07 /* main.c */; settings = {ATTRIBUTES = (); }; }; + 8DD76F6A0486A84900D96B5E /* PyKerberos.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = C6859E8B029090EE04C91782 /* PyKerberos.1 */; }; + AF88E9500FBA416E00C5AA9C /* kerberospw.c in Sources */ = {isa = PBXBuildFile; fileRef = AF88E94E0FBA416E00C5AA9C /* kerberospw.c */; }; + AFDE37FE0BB41E1D008C037E /* base64.c in Sources */ = {isa = PBXBuildFile; fileRef = AFDE37F80BB41E1D008C037E /* base64.c */; }; + AFDE37FF0BB41E1D008C037E /* kerberosbasic.c in Sources */ = {isa = PBXBuildFile; fileRef = AFDE37FA0BB41E1D008C037E /* kerberosbasic.c */; }; + AFDE38000BB41E1D008C037E /* kerberosgss.c in Sources */ = {isa = PBXBuildFile; fileRef = AFDE37FC0BB41E1D008C037E /* kerberosgss.c */; }; + AFDE380C0BB41EB7008C037E /* Python.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AFDE380B0BB41EB7008C037E /* Python.framework */; }; + AFDE38340BB41FCE008C037E /* Kerberos.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AFDE38330BB41FCE008C037E /* Kerberos.framework */; }; + AFDE383B0BB41FFA008C037E /* kerberos.c in Sources */ = {isa = PBXBuildFile; fileRef = AFDE383A0BB41FFA008C037E /* kerberos.c */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 8DD76F690486A84900D96B5E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 8; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + 8DD76F6A0486A84900D96B5E /* PyKerberos.1 in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 1; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 08FB7796FE84155DC02AAC07 /* main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = "<group>"; }; + 8DD76F6C0486A84900D96B5E /* PyKerberos */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = PyKerberos; sourceTree = BUILT_PRODUCTS_DIR; }; + AF88E94E0FBA416E00C5AA9C /* kerberospw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = kerberospw.c; path = ../src/kerberospw.c; sourceTree = SOURCE_ROOT; }; + AF88E94F0FBA416E00C5AA9C /* kerberospw.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = kerberospw.h; path = ../src/kerberospw.h; sourceTree = SOURCE_ROOT; }; + AFDE37F80BB41E1D008C037E /* base64.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = base64.c; path = ../src/base64.c; sourceTree = SOURCE_ROOT; }; + AFDE37F90BB41E1D008C037E /* base64.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = base64.h; path = ../src/base64.h; sourceTree = SOURCE_ROOT; }; + AFDE37FA0BB41E1D008C037E /* kerberosbasic.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = kerberosbasic.c; path = ../src/kerberosbasic.c; sourceTree = SOURCE_ROOT; }; + AFDE37FB0BB41E1D008C037E /* kerberosbasic.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = kerberosbasic.h; path = ../src/kerberosbasic.h; sourceTree = SOURCE_ROOT; }; + AFDE37FC0BB41E1D008C037E /* kerberosgss.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = kerberosgss.c; path = ../src/kerberosgss.c; sourceTree = SOURCE_ROOT; }; + AFDE37FD0BB41E1D008C037E /* kerberosgss.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = kerberosgss.h; path = ../src/kerberosgss.h; sourceTree = SOURCE_ROOT; }; + AFDE380B0BB41EB7008C037E /* Python.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Python.framework; path = /System/Library/Frameworks/Python.framework; sourceTree = "<absolute>"; }; + AFDE38330BB41FCE008C037E /* Kerberos.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Kerberos.framework; path = /System/Library/Frameworks/Kerberos.framework; sourceTree = "<absolute>"; }; + AFDE383A0BB41FFA008C037E /* kerberos.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = kerberos.c; path = ../src/kerberos.c; sourceTree = SOURCE_ROOT; }; + C6859E8B029090EE04C91782 /* PyKerberos.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = PyKerberos.1; sourceTree = "<group>"; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8DD76F660486A84900D96B5E /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + AFDE380C0BB41EB7008C037E /* Python.framework in Frameworks */, + AFDE38340BB41FCE008C037E /* Kerberos.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 08FB7794FE84155DC02AAC07 /* PyKerberos */ = { + isa = PBXGroup; + children = ( + 08FB7795FE84155DC02AAC07 /* Source */, + AFDE38300BB41F71008C037E /* Frameworks */, + C6859E8C029090F304C91782 /* Documentation */, + 1AB674ADFE9D54B511CA2CBB /* Products */, + ); + name = PyKerberos; + sourceTree = "<group>"; + }; + 08FB7795FE84155DC02AAC07 /* Source */ = { + isa = PBXGroup; + children = ( + AFDE383A0BB41FFA008C037E /* kerberos.c */, + AFDE37F80BB41E1D008C037E /* base64.c */, + AFDE37F90BB41E1D008C037E /* base64.h */, + AFDE37FA0BB41E1D008C037E /* kerberosbasic.c */, + AFDE37FB0BB41E1D008C037E /* kerberosbasic.h */, + AFDE37FC0BB41E1D008C037E /* kerberosgss.c */, + AFDE37FD0BB41E1D008C037E /* kerberosgss.h */, + AF88E94E0FBA416E00C5AA9C /* kerberospw.c */, + AF88E94F0FBA416E00C5AA9C /* kerberospw.h */, + 08FB7796FE84155DC02AAC07 /* main.c */, + ); + name = Source; + sourceTree = "<group>"; + }; + 1AB674ADFE9D54B511CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 8DD76F6C0486A84900D96B5E /* PyKerberos */, + ); + name = Products; + sourceTree = "<group>"; + }; + AFDE38300BB41F71008C037E /* Frameworks */ = { + isa = PBXGroup; + children = ( + AFDE38330BB41FCE008C037E /* Kerberos.framework */, + AFDE380B0BB41EB7008C037E /* Python.framework */, + ); + name = Frameworks; + sourceTree = "<group>"; + }; + C6859E8C029090F304C91782 /* Documentation */ = { + isa = PBXGroup; + children = ( + C6859E8B029090EE04C91782 /* PyKerberos.1 */, + ); + name = Documentation; + sourceTree = "<group>"; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 8DD76F620486A84900D96B5E /* PyKerberos */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1DEB923108733DC60010E9CD /* Build configuration list for PBXNativeTarget "PyKerberos" */; + buildPhases = ( + 8DD76F640486A84900D96B5E /* Sources */, + 8DD76F660486A84900D96B5E /* Frameworks */, + 8DD76F690486A84900D96B5E /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = PyKerberos; + productInstallPath = "$(HOME)/bin"; + productName = PyKerberos; + productReference = 8DD76F6C0486A84900D96B5E /* PyKerberos */; + productType = "com.apple.product-type.tool"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 08FB7793FE84155DC02AAC07 /* Project object */ = { + isa = PBXProject; + buildConfigurationList = 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "PyKerberos" */; + compatibilityVersion = "Xcode 3.0"; + hasScannedForEncodings = 1; + mainGroup = 08FB7794FE84155DC02AAC07 /* PyKerberos */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8DD76F620486A84900D96B5E /* PyKerberos */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 8DD76F640486A84900D96B5E /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DD76F650486A84900D96B5E /* main.c in Sources */, + AFDE37FE0BB41E1D008C037E /* base64.c in Sources */, + AFDE37FF0BB41E1D008C037E /* kerberosbasic.c in Sources */, + AFDE38000BB41E1D008C037E /* kerberosgss.c in Sources */, + AFDE383B0BB41FFA008C037E /* kerberos.c in Sources */, + AF88E9500FBA416E00C5AA9C /* kerberospw.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 1DEB923208733DC60010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "_GLIBCXX_DEBUG=1", + "_GLIBCXX_DEBUG_PEDANTIC=1", + ); + HEADER_SEARCH_PATHS = "/System/Library/Frameworks/Python.framework/Headers/**"; + INSTALL_PATH = /usr/local/bin; + PRODUCT_NAME = PyKerberos; + ZERO_LINK = YES; + }; + name = Debug; + }; + 1DEB923308733DC60010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = ( + ppc, + i386, + ); + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_MODEL_TUNING = G5; + HEADER_SEARCH_PATHS = "/System/Library/Frameworks/Python.framework/Headers/**"; + INSTALL_PATH = /usr/local/bin; + PRODUCT_NAME = PyKerberos; + }; + name = Release; + }; + 1DEB923608733DC60010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + PREBINDING = NO; + SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk"; + }; + name = Debug; + }; + 1DEB923708733DC60010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ""; + PREBINDING = NO; + SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk"; + USER_HEADER_SEARCH_PATHS = ..src; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1DEB923108733DC60010E9CD /* Build configuration list for PBXNativeTarget "PyKerberos" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB923208733DC60010E9CD /* Debug */, + 1DEB923308733DC60010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "PyKerberos" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB923608733DC60010E9CD /* Debug */, + 1DEB923708733DC60010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 08FB7793FE84155DC02AAC07 /* Project object */; +} diff --git a/support/main.c b/support/main.c new file mode 100644 index 0000000..f6e7b07 --- /dev/null +++ b/support/main.c @@ -0,0 +1,37 @@ +/** + * Copyright (c) 2006-2013 Apple Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +#include "kerberosgss.h" + +#include "stdio.h" + +int main (int argc, char * const argv[]) { + + int code = 0; + char* service = 0L; + gss_server_state state; + + service = server_principal_details("http", "caldav.local"); + + //printf("Got service principal: %s\n", result); + + //code = authenticate_user_krb5pwd("x", "x", "http/[email protected]", "CALDAV.CORP.APPLE.COM"); + + code = authenticate_gss_server_init("", &state); + code = authenticate_gss_server_clean(&state); + + return 0; +} diff --git a/test.py b/test.py new file mode 100644 index 0000000..eaae467 --- /dev/null +++ b/test.py @@ -0,0 +1,272 @@ +#!/usr/bin/env python +## +# Copyright (c) 2006-2013 Apple Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +## + +import kerberos +import getopt +import sys +import httplib +import socket +import ssl + +""" +Examples: + +sudo ./test.py -s [email protected] service + +sudo ./test.py -u user01 -p user01 -s [email protected] -r EXAMPLE.COM basic + +sudo ./test.py -s [email protected] -r EXAMPLE.COM gssapi + +./test.py -s [email protected] -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 + user = "" + pswd = "" + service = "[email protected]" + host = "host.example.com" + realm ="HOST.EXAMPLE.COM" + port = 8008 + use_ssl = False + allowedActions = ("service", "basic", "gssapi", "server",) + + options, args = getopt.getopt(sys.argv[1:], "u:p:s:h:i:r:x") + + for option, value in options: + if option == "-u": + user = value + elif option == "-p": + pswd = value + elif option == "-s": + service = value + elif option == "-h": + host = value + elif option == "-i": + port = value + elif option == "-r": + realm = value + elif option == "-x": + use_ssl = True + + actions = set() + for arg in args: + if arg in allowedActions: + actions.add(arg) + else: + print "Action not allowed: %s" % (arg,) + sys.exit(1) + + # Get service principal + if "service" in actions: + print "\n*** Running Service Principal test" + s, h = service.split("@") + testServicePrincipal(s, h); + + # GSS Basic test + if "basic" in actions: + if (len(user) != 0) and (len(pswd) != 0): + print "\n*** Running basic test" + testCheckpassword(user, pswd, service, realm) + else: + print "\n*** Skipping basic test: no user or password specified" + + # Full GSSAPI test + if "gssapi" in actions: + print "\n*** Running GSSAPI test" + testGSSAPI(service) + + if "server" in actions: + print "\n*** Running HTTP test" + testHTTP(host, port, use_ssl, service) + + print "\n*** Done\n" + +def testServicePrincipal(service, hostname): + try: + result = kerberos.getServerPrincipalDetails(service, hostname) + except kerberos.KrbError, e: + print "Kerberos service principal for %s/%s failed: %s" % (service, hostname, e[0]) + else: + print "Kerberos service principal for %s/%s succeeded: %s" % (service, hostname, result) + +def testCheckpassword(user, pswd, service, realm): + try: + kerberos.checkPassword(user, pswd, service, realm) + except kerberos.BasicAuthError, e: + print "Kerberos authentication for %s failed: %s" % (user, e[0]) + else: + print "Kerberos authentication for %s succeeded" % user + +def testGSSAPI(service): + def statusText(r): + if r == 1: + return "Complete" + elif r == 0: + return "Continue" + else: + return "Error" + + rc, vc = kerberos.authGSSClientInit(service); + print "Status for authGSSClientInit = %s" % statusText(rc); + if rc != 1: + return + + rs, vs = kerberos.authGSSServerInit(service); + print "Status for authGSSServerInit = %s" % statusText(rs); + if rs != 1: + return + + rc = kerberos.authGSSClientStep(vc, ""); + print "Status for authGSSClientStep = %s" % statusText(rc); + if rc != 0: + return + + rs = kerberos.authGSSServerStep(vs, kerberos.authGSSClientResponse(vc)); + print "Status for authGSSServerStep = %s" % statusText(rs); + if rs == -1: + return + + rc = kerberos.authGSSClientStep(vc, kerberos.authGSSServerResponse(vs)); + print "Status for authGSSClientStep = %s" % statusText(rc); + if rc == -1: + return + + print "Server user name: %s" % kerberos.authGSSServerUserName(vs); + print "Server target name: %s" % kerberos.authGSSServerTargetName(vs); + print "Client user name: %s" % kerberos.authGSSClientUserName(vc); + + rc = kerberos.authGSSClientClean(vc); + print "Status for authGSSClientClean = %s" % statusText(rc); + + rs = kerberos.authGSSServerClean(vs); + print "Status for authGSSServerClean = %s" % statusText(rs); + +def testHTTP(host, port, use_ssl, service): + + class HTTPSConnection_SSLv3(httplib.HTTPSConnection): + "This class allows communication via SSL." + + def connect(self): + "Connect to a host on a given (SSL) port." + + sock = socket.create_connection((self.host, self.port), self.timeout) + self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file, ssl_version=ssl.PROTOCOL_SSLv3) + + def sendRequest(host, port, ssl, method, uri, headers): + response = None + if use_ssl: + http = HTTPSConnection_SSLv3(host, port) + else: + http = httplib.HTTPConnection(host, port) + try: + http.request(method, uri, "", headers) + response = http.getresponse() + finally: + http.close() + + return response + + # Initial request without auth header + uri = "/principals/" + response = sendRequest(host, port, use_ssl, "OPTIONS", uri, {}) + + if response is None: + print "Initial HTTP request to server failed" + return + + if response.status != 401: + print "Initial HTTP request did not result in a 401 response" + return + + hdrs = response.msg.getheaders("www-authenticate") + if (hdrs is None) or (len(hdrs) == 0): + print "No www-authenticate header in initial HTTP response." + for hdr in hdrs: + hdr = hdr.strip() + splits = hdr.split(' ', 1) + if (len(splits) != 1) or (splits[0].lower() != "negotiate"): + continue + else: + break + else: + print "No www-authenticate header with negotiate in initial HTTP response." + return + + try: + rc, vc = kerberos.authGSSClientInit(service=service); + except kerberos.GSSError, e: + print "Could not initialize GSSAPI: %s/%s" % (e[0][0], e[1][0]) + return + + try: + kerberos.authGSSClientStep(vc, ""); + except kerberos.GSSError, e: + print "Could not do GSSAPI step with continue: %s/%s" % (e[0][0], e[1][0]) + return + + hdrs = {} + hdrs["Authorization"] = "negotiate %s" % kerberos.authGSSClientResponse(vc) + + # Second request with auth header + response = sendRequest(host, port, use_ssl, "OPTIONS", uri, hdrs) + + if response is None: + print "Second HTTP request to server failed" + return + + if response.status/100 != 2: + print "Second HTTP request did not result in a 2xx response: %d" % (response.status,) + return + + hdrs = response.msg.getheaders("www-authenticate") + if (hdrs is None) or (len(hdrs) == 0): + print "No www-authenticate header in second HTTP response." + return + for hdr in hdrs: + hdr = hdr.strip() + splits = hdr.split(' ', 1) + if (len(splits) != 2) or (splits[0].lower() != "negotiate"): + continue + else: + break + else: + print "No www-authenticate header with negotiate in second HTTP response." + return + + try: + kerberos.authGSSClientStep(vc, splits[1]) + except kerberos.GSSError, e: + print "Could not verify server www-authenticate header in second HTTP response: %s/%s" % (e[0][0], e[1][0]) + return + + try: + rc = kerberos.authGSSClientClean(vc); + except kerberos.GSSError, e: + print "Could not clean-up GSSAPI: %s/%s" % (e[0][0], e[1][0]) + return + + print "Authenticated successfully" + return + +if __name__=='__main__': + main()
0
b69d90ae925952b727b6445e35f1af59b155675a
02strich
pykerberos
Correct pointer alignment - Changes copied from https://github.com/apple/ccs-pykerberos/commit/bfeef2739973cb59e7ef9923f8c76104223c0306?diff=split
commit b69d90ae925952b727b6445e35f1af59b155675a Author: Devashish Chandra <[email protected]> Date: Mon Jan 3 21:08:48 2022 +0530 Correct pointer alignment - Changes copied from https://github.com/apple/ccs-pykerberos/commit/bfeef2739973cb59e7ef9923f8c76104223c0306?diff=split diff --git a/src/kerberos.c b/src/kerberos.c index d4d0a1f..637b076 100644 --- a/src/kerberos.c +++ b/src/kerberos.c @@ -35,11 +35,14 @@ #define PyClear(object) PyCObject_SetVoidPtr(object, NULL) #endif -static char krb5_mech_oid_bytes [] = "\x2a\x86\x48\x86\xf7\x12\x01\x02\x02"; -gss_OID_desc krb5_mech_oid = { 9, &krb5_mech_oid_bytes }; +typedef union { char b[16]; uint64_t ull[2]; } align16; +typedef union { char b[8]; uint64_t ull; } align8; -static char spnego_mech_oid_bytes[] = "\x2b\x06\x01\x05\x05\x02"; -gss_OID_desc spnego_mech_oid = { 6, &spnego_mech_oid_bytes }; +static align16 krb5_mech_oid_bytes = { { 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x12, 0x01, 0x02, 0x02 } }; +gss_OID_desc krb5_mech_oid = { 9, NULL }; + +static align8 spnego_mech_oid_bytes = { { 0x2b, 0x06, 0x01, 0x05, 0x05, 0x02 } }; +gss_OID_desc spnego_mech_oid = { 6, NULL }; PyObject *KrbException_class; PyObject *BasicAuthException_class; @@ -834,7 +837,9 @@ void initkerberos(void) PyDict_SetItemString(d, "GSS_C_ANON_FLAG", PyInt_FromLong(GSS_C_ANON_FLAG)); PyDict_SetItemString(d, "GSS_C_PROT_READY_FLAG", PyInt_FromLong(GSS_C_PROT_READY_FLAG)); PyDict_SetItemString(d, "GSS_C_TRANS_FLAG", PyInt_FromLong(GSS_C_TRANS_FLAG)); + krb5_mech_oid.elements = &krb5_mech_oid_bytes.b; PyDict_SetItemString(d, "GSS_MECH_OID_KRB5", PyNew(&krb5_mech_oid, NULL)); + spnego_mech_oid.elements = &spnego_mech_oid_bytes.b; PyDict_SetItemString(d, "GSS_MECH_OID_SPNEGO", PyNew(&spnego_mech_oid, NULL)); PyDict_SetItemString(d, "GSS_C_AF_UNSPEC", PyInt_FromLong(GSS_C_AF_UNSPEC));
0
873fca96cb42ff1c163859a5618dc9983796f438
02strich
pykerberos
obviously, verify shouldn't be const I found this when compiled by clang. gcc didn't respect the const qualifiers, however.
commit 873fca96cb42ff1c163859a5618dc9983796f438 Author: Z. Liu <[email protected]> Date: Thu Aug 17 00:01:21 2017 +0800 obviously, verify shouldn't be const I found this when compiled by clang. gcc didn't respect the const qualifiers, however. diff --git a/src/kerberos.c b/src/kerberos.c index 98d8ce0..cdebf68 100644 --- a/src/kerberos.c +++ b/src/kerberos.c @@ -50,7 +50,7 @@ static PyObject *checkPassword(PyObject *self, PyObject *args) { const char *pswd = NULL; const char *service = NULL; const char *default_realm = NULL; - const int verify = 1; + int verify = 1; int result = 0; if (!PyArg_ParseTuple(args, "ssss|b", &user, &pswd, &service, &default_realm, &verify)) {
0
7e36e528880ae9dfb0a263fcf56cc757504a223c
02strich
pykerberos
fixes for Python 3.10
commit 7e36e528880ae9dfb0a263fcf56cc757504a223c Author: Matt Davis <[email protected]> Date: Tue Nov 9 15:43:26 2021 -0800 fixes for Python 3.10 diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..efbfe19 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,33 @@ +name: pykerberos CI +on: + push: + pull_request: + +jobs: + linux: + runs-on: ubuntu-20.04 + strategy: + matrix: + include: + - python: 2.7 + - python: 3.6 + - python: 3.7 + - python: 3.8 + - python: 3.9 + - python: '3.10' + steps: + - name: checkout + uses: actions/checkout@v2 + + - name: install Python + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python }} + + - name: test build/install + run: | + sudo apt-get update -qq + sudo apt-get install libkrb5-dev + + python -V + python -m pip install . diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 5cb5f78..0000000 --- a/.travis.yml +++ /dev/null @@ -1,14 +0,0 @@ -language: python -python: - - "2.7" - - "3.4" - - "3.5" - - "3.6" - - "3.7" - - "3.8" -before_install: - - sudo apt-get update -qq - - sudo apt-get install libkrb5-dev -install: - - pip install . -script: date diff --git a/src/kerberos.c b/src/kerberos.c index 43cf5e0..d4d0a1f 100644 --- a/src/kerberos.c +++ b/src/kerberos.c @@ -14,6 +14,7 @@ * limitations under the License. **/ +#define PY_SSIZE_T_CLEAN #include <Python.h> #include "kerberosbasic.h" @@ -196,9 +197,9 @@ static PyObject *channelBindings(PyObject *self, PyObject *args, PyObject* keywd char *initiator_address = NULL; char *acceptor_address = NULL; char *application_data = NULL; - int initiator_length = 0; - int acceptor_length = 0; - int application_length = 0; + Py_ssize_t initiator_length = 0; + Py_ssize_t acceptor_length = 0; + Py_ssize_t application_length = 0; PyObject *pychan_bindings = NULL; struct gss_channel_bindings_struct *input_chan_bindings;
0
7a501fb33e1bd61ab7fabb54ffe051b5c31e18b5
02strich
pykerberos
Load correct httplib for py3
commit 7a501fb33e1bd61ab7fabb54ffe051b5c31e18b5 Author: Stefan Richter <[email protected]> Date: Sun Nov 8 19:25:32 2015 -0800 Load correct httplib for py3 diff --git a/test.py b/test.py index eaae467..2491dac 100644 --- a/test.py +++ b/test.py @@ -19,7 +19,10 @@ import kerberos import getopt import sys -import httplib +try: + import httplib +except ImportError as ex: + import http.client as httplib import socket import ssl
0
405ab1e69c3dc3f25ca1e9764b90ae03c15b1514
02strich
pykerberos
Migrate usage of commands to subprocess to work on Python 3
commit 405ab1e69c3dc3f25ca1e9764b90ae03c15b1514 Author: Stefan Richter <[email protected]> Date: Wed Feb 12 19:38:58 2014 +0100 Migrate usage of commands to subprocess to work on Python 3 diff --git a/setup.py b/setup.py index 616ab17..06559a8 100644 --- a/setup.py +++ b/setup.py @@ -15,8 +15,8 @@ ## from distutils.core import setup, Extension +import subprocess import sys -import commands long_description = """ This Python package is a high-level wrapper for Kerberos (GSSAPI) operations. @@ -35,14 +35,15 @@ setup ( classifiers = [ "License :: OSI Approved :: Apache Software License", "Programming Language :: Python :: 2", + "Programming Language :: Python :: 3", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: System :: Systems Administration :: Authentication/Directory" ], ext_modules = [ Extension( "kerberos", - extra_link_args = commands.getoutput("krb5-config --libs gssapi").split(), - extra_compile_args = commands.getoutput("krb5-config --cflags gssapi").split(), + extra_link_args = subprocess.check_output(["krb5-config", "--libs", "gssapi"], universal_newlines=True).split(), + extra_compile_args = subprocess.check_output(["krb5-config", "--cflags", "gssapi"], universal_newlines=True).split(), sources = [ "src/kerberos.c", "src/kerberosbasic.c",
0
e8e7c8812ef66d3f697234d7d950331cc3214dfe
02strich
pykerberos
python 3 compatibility
commit e8e7c8812ef66d3f697234d7d950331cc3214dfe Author: Stefan Richter <[email protected]> Date: Wed Feb 12 20:44:52 2014 +0100 python 3 compatibility diff --git a/src/kerberos.c b/src/kerberos.c index bf55b27..ed7e0fa 100644 --- a/src/kerberos.c +++ b/src/kerberos.c @@ -20,6 +20,10 @@ #include "kerberospw.h" #include "kerberosgss.h" +#if PY_MAJOR_VERSION >= 3 + #define PyInt_FromLong PyLong_FromLong +#endif + PyObject *KrbException_class; PyObject *BasicAuthException_class; PyObject *PwdChangeException_class; @@ -97,7 +101,11 @@ static PyObject* authGSSClientInit(PyObject* self, PyObject* args, PyObject* key return NULL; state = (gss_client_state *) malloc(sizeof(gss_client_state)); +#if PY_MAJOR_VERSION >= 3 + pystate = PyCapsule_New(state, NULL, NULL); +#else pystate = PyCObject_FromVoidPtr(state, NULL); +#endif result = authenticate_gss_client_init(service, principal, gss_flags, state); if (result == AUTH_GSS_ERROR) @@ -115,18 +123,30 @@ static PyObject *authGSSClientClean(PyObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "O", &pystate)) return NULL; +#if PY_MAJOR_VERSION >= 3 + if (!PyCapsule_CheckExact(pystate)) { +#else if (!PyCObject_Check(pystate)) { +#endif PyErr_SetString(PyExc_TypeError, "Expected a context object"); return NULL; } +#if PY_MAJOR_VERSION >= 3 + state = PyCapsule_GetPointer(pystate, NULL); +#else state = (gss_client_state *)PyCObject_AsVoidPtr(pystate); +#endif if (state != NULL) { result = authenticate_gss_client_clean(state); free(state); +#if PY_MAJOR_VERSION >= 3 + PyCapsule_SetPointer(pystate, NULL); +#else PyCObject_SetVoidPtr(pystate, NULL); +#endif } return Py_BuildValue("i", result); @@ -142,12 +162,20 @@ static PyObject *authGSSClientStep(PyObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "Os", &pystate, &challenge)) return NULL; +#if PY_MAJOR_VERSION >= 3 + if (!PyCapsule_CheckExact(pystate)) { +#else if (!PyCObject_Check(pystate)) { +#endif PyErr_SetString(PyExc_TypeError, "Expected a context object"); return NULL; } +#if PY_MAJOR_VERSION >= 3 + state = PyCapsule_GetPointer(pystate, NULL); +#else state = (gss_client_state *)PyCObject_AsVoidPtr(pystate); +#endif if (state == NULL) return NULL; @@ -166,12 +194,20 @@ static PyObject *authGSSClientResponseConf(PyObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "O", &pystate)) return NULL; +#if PY_MAJOR_VERSION >= 3 + if (!PyCapsule_CheckExact(pystate)) { +#else if (!PyCObject_Check(pystate)) { +#endif PyErr_SetString(PyExc_TypeError, "Expected a context object"); return NULL; } +#if PY_MAJOR_VERSION >= 3 + state = PyCapsule_GetPointer(pystate, NULL); +#else state = (gss_client_state *)PyCObject_AsVoidPtr(pystate); +#endif if (state == NULL) return NULL; @@ -186,12 +222,20 @@ static PyObject *authGSSClientResponse(PyObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "O", &pystate)) return NULL; +#if PY_MAJOR_VERSION >= 3 + if (!PyCapsule_CheckExact(pystate)) { +#else if (!PyCObject_Check(pystate)) { +#endif PyErr_SetString(PyExc_TypeError, "Expected a context object"); return NULL; } +#if PY_MAJOR_VERSION >= 3 + state = PyCapsule_GetPointer(pystate, NULL); +#else state = (gss_client_state *)PyCObject_AsVoidPtr(pystate); +#endif if (state == NULL) return NULL; @@ -206,12 +250,20 @@ static PyObject *authGSSClientUserName(PyObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "O", &pystate)) return NULL; +#if PY_MAJOR_VERSION >= 3 + if (!PyCapsule_CheckExact(pystate)) { +#else if (!PyCObject_Check(pystate)) { +#endif PyErr_SetString(PyExc_TypeError, "Expected a context object"); return NULL; } +#if PY_MAJOR_VERSION >= 3 + state = PyCapsule_GetPointer(pystate, NULL); +#else state = (gss_client_state *)PyCObject_AsVoidPtr(pystate); +#endif if (state == NULL) return NULL; @@ -228,12 +280,20 @@ static PyObject *authGSSClientUnwrap(PyObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "Os", &pystate, &challenge)) return NULL; - if (!PyCObject_Check(pystate)) { +#if PY_MAJOR_VERSION >= 3 + if (!PyCapsule_CheckExact(pystate)) { +#else + if (!PyCObject_Check(pystate)) { +#endif PyErr_SetString(PyExc_TypeError, "Expected a context object"); return NULL; } - state = (gss_client_state *)PyCObject_AsVoidPtr(pystate); +#if PY_MAJOR_VERSION >= 3 + state = PyCapsule_GetPointer(pystate, NULL); +#else + state = (gss_client_state *)PyCObject_AsVoidPtr(pystate); +#endif if (state == NULL) return NULL; @@ -256,12 +316,20 @@ static PyObject *authGSSClientWrap(PyObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "Os|zi", &pystate, &challenge, &user, &protect)) return NULL; - if (!PyCObject_Check(pystate)) { +#if PY_MAJOR_VERSION >= 3 + if (!PyCapsule_CheckExact(pystate)) { +#else + if (!PyCObject_Check(pystate)) { +#endif PyErr_SetString(PyExc_TypeError, "Expected a context object"); return NULL; } - state = (gss_client_state *)PyCObject_AsVoidPtr(pystate); +#if PY_MAJOR_VERSION >= 3 + state = PyCapsule_GetPointer(pystate, NULL); +#else + state = (gss_client_state *)PyCObject_AsVoidPtr(pystate); +#endif if (state == NULL) return NULL; @@ -283,7 +351,11 @@ static PyObject *authGSSServerInit(PyObject *self, PyObject *args) return NULL; state = (gss_server_state *) malloc(sizeof(gss_server_state)); +#if PY_MAJOR_VERSION >= 3 + pystate = PyCapsule_New(state, NULL, NULL); +#else pystate = PyCObject_FromVoidPtr(state, NULL); +#endif result = authenticate_gss_server_init(service, state); if (result == AUTH_GSS_ERROR) @@ -301,18 +373,30 @@ static PyObject *authGSSServerClean(PyObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "O", &pystate)) return NULL; +#if PY_MAJOR_VERSION >= 3 + if (!PyCapsule_CheckExact(pystate)) { +#else if (!PyCObject_Check(pystate)) { +#endif PyErr_SetString(PyExc_TypeError, "Expected a context object"); return NULL; } - state = (gss_server_state *)PyCObject_AsVoidPtr(pystate); +#if PY_MAJOR_VERSION >= 3 + state = PyCapsule_GetPointer(pystate, NULL); +#else + state = (gss_client_state *)PyCObject_AsVoidPtr(pystate); +#endif if (state != NULL) { result = authenticate_gss_server_clean(state); free(state); +#if PY_MAJOR_VERSION >= 3 + PyCapsule_SetPointer(pystate, NULL); +#else PyCObject_SetVoidPtr(pystate, NULL); +#endif } return Py_BuildValue("i", result); @@ -328,12 +412,20 @@ static PyObject *authGSSServerStep(PyObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "Os", &pystate, &challenge)) return NULL; +#if PY_MAJOR_VERSION >= 3 + if (!PyCapsule_CheckExact(pystate)) { +#else if (!PyCObject_Check(pystate)) { +#endif PyErr_SetString(PyExc_TypeError, "Expected a context object"); return NULL; } - state = (gss_server_state *)PyCObject_AsVoidPtr(pystate); +#if PY_MAJOR_VERSION >= 3 + state = PyCapsule_GetPointer(pystate, NULL); +#else + state = (gss_client_state *)PyCObject_AsVoidPtr(pystate); +#endif if (state == NULL) return NULL; @@ -352,12 +444,20 @@ static PyObject *authGSSServerResponse(PyObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "O", &pystate)) return NULL; +#if PY_MAJOR_VERSION >= 3 + if (!PyCapsule_CheckExact(pystate)) { +#else if (!PyCObject_Check(pystate)) { +#endif PyErr_SetString(PyExc_TypeError, "Expected a context object"); return NULL; } - state = (gss_server_state *)PyCObject_AsVoidPtr(pystate); +#if PY_MAJOR_VERSION >= 3 + state = PyCapsule_GetPointer(pystate, NULL); +#else + state = (gss_client_state *)PyCObject_AsVoidPtr(pystate); +#endif if (state == NULL) return NULL; @@ -372,12 +472,20 @@ static PyObject *authGSSServerUserName(PyObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "O", &pystate)) return NULL; +#if PY_MAJOR_VERSION >= 3 + if (!PyCapsule_CheckExact(pystate)) { +#else if (!PyCObject_Check(pystate)) { +#endif PyErr_SetString(PyExc_TypeError, "Expected a context object"); return NULL; } - state = (gss_server_state *)PyCObject_AsVoidPtr(pystate); +#if PY_MAJOR_VERSION >= 3 + state = PyCapsule_GetPointer(pystate, NULL); +#else + state = (gss_client_state *)PyCObject_AsVoidPtr(pystate); +#endif if (state == NULL) return NULL; @@ -392,12 +500,20 @@ static PyObject *authGSSServerTargetName(PyObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "O", &pystate)) return NULL; +#if PY_MAJOR_VERSION >= 3 + if (!PyCapsule_CheckExact(pystate)) { +#else if (!PyCObject_Check(pystate)) { +#endif PyErr_SetString(PyExc_TypeError, "Expected a context object"); return NULL; } - state = (gss_server_state *)PyCObject_AsVoidPtr(pystate); +#if PY_MAJOR_VERSION >= 3 + state = PyCapsule_GetPointer(pystate, NULL); +#else + state = (gss_client_state *)PyCObject_AsVoidPtr(pystate); +#endif if (state == NULL) return NULL; @@ -442,11 +558,29 @@ static PyMethodDef KerberosMethods[] = { {NULL, NULL, 0, NULL} /* Sentinel */ }; +#if PY_MAJOR_VERSION >= 3 + static struct PyModuleDef moduledef = { + PyModuleDef_HEAD_INIT, + "kerberos", /* m_name */ + "High-level interface to kerberos", /* m_doc */ + -1, /* m_size */ + KerberosMethods, /* m_methods */ + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL, /* m_free */ + }; +#endif + PyMODINIT_FUNC initkerberos(void) { PyObject *m,*d; +#if PY_MAJOR_VERSION >= 3 + m = PyModule_Create(&moduledef); +#else m = Py_InitModule("kerberos", KerberosMethods); +#endif d = PyModule_GetDict(m); @@ -488,4 +622,7 @@ PyMODINIT_FUNC initkerberos(void) error: if (PyErr_Occurred()) PyErr_SetString(PyExc_ImportError, "kerberos: init failed"); +#if PY_MAJOR_VERSION >= 3 + return m; +#endif }
0
adf180a650cdb9a213c7cfe8bb7ef292e2c0742b
02strich
pykerberos
Remove reference to undefined popenargs variable
commit adf180a650cdb9a213c7cfe8bb7ef292e2c0742b Author: Stefan Richter <[email protected]> Date: Wed Feb 10 22:36:48 2016 -0800 Remove reference to undefined popenargs variable diff --git a/setup.py b/setup.py index c394206..8879860 100644 --- a/setup.py +++ b/setup.py @@ -28,13 +28,11 @@ Kerberos authentication based on <http://www.ietf.org/rfc/rfc4559.txt>. def check_krb5_config(*options, **kwargs): try: - process = subprocess.Popen((kwargs.get('command_name', 'krb5-config'),) + options, stdout=subprocess.PIPE, universal_newlines=True) + cmd = kwargs.get('command_name', 'krb5-config') + process = subprocess.Popen((cmd,) + options, stdout=subprocess.PIPE, universal_newlines=True) output, unused_err = process.communicate() retcode = process.poll() if retcode: - cmd = kwargs.get("args") - if cmd is None: - cmd = popenargs[0] raise subprocess.CalledProcessError(retcode, cmd, output=output) return output.split() except OSError as e:
0
a3751b2795bd5c3b2a742502ddb7d0895c31445f
02strich
pykerberos
changes based on upstream PR
commit a3751b2795bd5c3b2a742502ddb7d0895c31445f Author: Jordan Borean <[email protected]> Date: Tue Aug 8 07:53:02 2017 +1000 changes based on upstream PR diff --git a/README.txt b/README.txt index 7e0d809..c4a8486 100644 --- a/README.txt +++ b/README.txt @@ -65,6 +65,59 @@ Then run test.py with suitable command line arguments: -p : password for basic authenticate -s : service principal for GSSAPI authentication (defaults to '[email protected]') +================ +CHANNEL BINDINGS +================ + +You can use this library to authenticate with Channel Binding support. Channel +Bindings are tags that identify the particular data channel being used with the +authentication. You can use Channel bindings to offer more proof of a valid +identity. Some services like Microsoft's Extended Protection can enforce +Channel Binding support on authorisation and you can use this library to meet +those requirements. + +More details on Channel Bindings as set through the GSSAPI can be found here +<https://docs.oracle.com/cd/E19455-01/806-3814/overview-52/index.html>. Using +TLS as a example this is how you would add Channel Binding support to your +authentication mechanism. The following code snippet is based on RFC5929 +<https://tools.ietf.org/html/rfc5929> using the 'tls-server-endpoint-point' +type. + +.. code-block:: python + + import hashlib + + def get_channel_bindings_application_data(socket): + # This is a highly simplified example, there are other use cases + # where you might need to use different hash types or get a socket + # object somehow. + server_certificate = socket.getpeercert(True) + certificate_hash = hashlib.sha256(server_certificate).hexdigest().upper() + certificate_digest = base64.b16decode(certificate_hash) + application_data = b'tls-server-end-point:%s' % certificate_digest + + return application_data + + def main(): + # Code to setup a socket with the server + # A lot of code to setup the handshake and start the auth process + socket = getsocketsomehow() + + # Connect to the host and start the auth process + + # Build the channel bindings object + application_data = get_channel_bindings_application_data(socket) + channel_bindings = kerberos.channelBindings(application_data=application_data) + + # More work to get responses from the server + + result, context = kerberos.authGSSClientInit(kerb_spn, gssflags=gssflags, principal=principal) + + # Pass through the channel_bindings object as created in the kerberos.channelBindings method + result = kerberos.authGSSClientStep(context, neg_resp_value, channel_bindings=channel_bindings) + + # Repeat as necessary + =========== Python APIs =========== diff --git a/pysrc/kerberos.py b/pysrc/kerberos.py index 7a708c9..a19fd09 100644 --- a/pysrc/kerberos.py +++ b/pysrc/kerberos.py @@ -130,13 +130,16 @@ def authGSSClientClean(context): @return: a result code (see above). """ -def authGSSClientStep(context, challenge): +def authGSSClientStep(context, challenge, **kwargs): """ Processes a single GSSAPI client-side step using the supplied server data. @param context: the context object returned from authGSSClientInit. @param challenge: a string containing the base64-encoded server data (which may be empty for the first step). + @param channel_bindings: Optional channel bindings to bind onto the auth request. This + struct can be built using the channelBindings function and it not specified, this process + will pass along GSS_C_NO_CHANNEL_BINDINGS as a default @return: a result code (see above). """ @@ -238,3 +241,52 @@ def authGSSServerTargetName(context): @param context: the context object returned from authGSSServerInit. @return: a string containing the target name. """ + +""" +Address Types for Channel Bindings +https://docs.oracle.com/cd/E19455-01/806-3814/6jcugr7dp/index.html#reference-9 +""" + +GSS_C_AF_UNSPEC = 0 +GSS_C_AF_LOCAL = 1 +GSS_C_AF_INET = 2 +GSS_C_AF_IMPLINK = 3 +GSS_C_AF_PUP = 4 +GSS_C_AF_CHAOS = 5 +GSS_C_AF_NS = 6 +GSS_C_AF_NBS = 7 +GSS_C_AF_ECMA = 8 +GSS_C_AF_DATAKIT = 9 +GSS_C_AF_CCITT = 10 +GSS_C_AF_SNA = 11 +GSS_C_AF_DECnet = 12 +GSS_C_AF_DLI = 13 +GSS_C_AF_LAT = 14 +GSS_C_AF_HYLINK = 15 +GSS_C_AF_APPLETALK = 16 +GSS_C_AF_BSC = 17 +GSS_C_AF_DSS = 18 +GSS_C_AF_OSI = 19 +GSS_C_AF_X25 = 21 +GSS_C_AF_NULLADDR = 255 + +def channelBindings(**kwargs): + """ + Builds a gss_channel_bindings_struct which can be used to pass onto authGSSClientStep to bind + onto the auth. Details on Channel Bindings can be found at https://tools.ietf.org/html/rfc5929. + More details on the struct can be found at https://docs.oracle.com/cd/E19455-01/806-3814/overview-52/index.html + + @param initiator_addrtype: Optional integer used to set the + initiator_addrtype, defaults to GSS_C_AF_UNSPEC if not set + @param initiator_address: Optional byte string containing the + initiator_address + @param acceptor_addrtype: Optional integer used to set the + acceptor_addrtype, defaults to GSS_C_AF_UNSPEC if not set + @param acceptor_address: Optional byte string containing the + acceptor_address + @param application_data: Optional byte string containing the + application_data. An example would be 'tls-server-end-point:{cert-hash}' + where {cert-hash} is the byte string hash of the server's certificate + @return: The gss_channel_bindings_struct pointer, which is the channel + bindings structure that can be passed onto authGSSClientStep + """ diff --git a/setup.py b/setup.py index 6ae96d3..5501381 100644 --- a/setup.py +++ b/setup.py @@ -58,7 +58,7 @@ if krb5_ver: setup ( name = "pykerberos", - version = "1.1.14", + version = "1.2.0", description = "High-level interface to Kerberos", long_description=long_description, license="ASL 2.0", diff --git a/src/kerberos.c b/src/kerberos.c index 21b5eb2..e6c9007 100644 --- a/src/kerberos.c +++ b/src/kerberos.c @@ -163,48 +163,68 @@ static PyObject *authGSSClientClean(PyObject *self, PyObject *args) { return Py_BuildValue("i", AUTH_GSS_COMPLETE); } -static PyObject *buildChannelBindingsStruct(PyObject *self, PyObject *args, PyObject* keywds) { +#if PY_MAJOR_VERSION >= 3 +void destruct_channel_bindings(PyObject* o) { + struct gss_channel_bindings_struct *channel_bindings = PyCapsule_GetPointer(o, NULL); +#else +void destruct_channel_bindings(void* o) { + struct gss_channel_bindings_struct *channel_bindings = (struct gss_channel_bindings_struct *)o; +#endif + + if (channel_bindings != NULL) { + if (channel_bindings->initiator_address.value != NULL) { + PyMem_Free(channel_bindings->initiator_address.value); + } + + if (channel_bindings->acceptor_address.value != NULL) { + PyMem_Free(channel_bindings->acceptor_address.value); + } + + if (channel_bindings->application_data.value != NULL) { + PyMem_Free(channel_bindings->application_data.value); + } + + free(channel_bindings); + } +} + +static PyObject *channelBindings(PyObject *self, PyObject *args, PyObject* keywds) { int initiator_addrtype = GSS_C_AF_UNSPEC; int acceptor_addrtype = GSS_C_AF_UNSPEC; - const char *initiator_address = NULL; - const char *acceptor_address = NULL; - const char *application_data = NULL; - PyObject *pychan_bindings; + + const char *encoding = NULL; + char *initiator_address = NULL; + char *acceptor_address = NULL; + char *application_data = NULL; + int initiator_length = NULL; + int acceptor_length = NULL; + int application_length = NULL; + + PyObject *pychan_bindings = NULL; struct gss_channel_bindings_struct *input_chan_bindings; - static char *kwlist[] = {"initiator_addrtype", "acceptor_addrtype", "initiator_address", "acceptor_address", "application_data", NULL}; + static char *kwlist[] = {"initiator_addrtype", "initiator_address", "acceptor_addrtype", + "acceptor_address", "application_data", NULL}; - if (!PyArg_ParseTupleAndKeywords(args, keywds, "|iisss", kwlist, &initiator_addrtype, &acceptor_addrtype, &initiator_address, &acceptor_address, &application_data)) { - return NULL; - } + if (!PyArg_ParseTupleAndKeywords(args, keywds, "|iet#iet#et#", kwlist, + &initiator_addrtype, &encoding, &initiator_address, &initiator_length, + &acceptor_addrtype, &encoding, &acceptor_address, &acceptor_length, + &encoding, &application_data, &application_length)) { + return NULL; + } - input_chan_bindings = (struct gss_channel_bindings_struct *) malloc(sizeof(struct gss_channel_bindings_struct)); - pychan_bindings = PyNew(input_chan_bindings, NULL); + input_chan_bindings = (struct gss_channel_bindings_struct *) malloc(sizeof(struct gss_channel_bindings_struct)); + pychan_bindings = PyNew(input_chan_bindings, &destruct_channel_bindings); input_chan_bindings->initiator_addrtype = initiator_addrtype; - if (initiator_address == NULL) { - input_chan_bindings->initiator_address.length = 0; - input_chan_bindings->initiator_address.value = NULL; - } else { - input_chan_bindings->initiator_address.length = strlen(initiator_address); - input_chan_bindings->initiator_address.value = (char *)initiator_address; - } + input_chan_bindings->initiator_address.length = initiator_length; + input_chan_bindings->initiator_address.value = initiator_address; input_chan_bindings->acceptor_addrtype = acceptor_addrtype; - if (acceptor_address == NULL) { - input_chan_bindings->acceptor_address.length = 0; - input_chan_bindings->acceptor_address.value = NULL; - } else { - input_chan_bindings->acceptor_address.length = strlen(acceptor_address); - input_chan_bindings->acceptor_address.value = (char *)acceptor_address; - } + input_chan_bindings->acceptor_address.length = acceptor_length; + input_chan_bindings->acceptor_address.value = acceptor_address; - if (application_data == NULL) { - input_chan_bindings->application_data.length = 0; - input_chan_bindings->application_data.value = NULL; - } else { - input_chan_bindings->application_data.length = strlen(application_data); - input_chan_bindings->application_data.value = (char *)application_data; - } + input_chan_bindings->application_data.length = application_length; + input_chan_bindings->application_data.value = application_data; return Py_BuildValue("N", pychan_bindings); } @@ -214,11 +234,11 @@ static PyObject *authGSSClientStep(PyObject *self, PyObject *args, PyObject* key PyObject *pystate; char *challenge = NULL; PyObject *pychan_bindings = NULL; - struct gss_channel_bindings_struct *input_chan_bindings; - static char *kwlist[] = {"state", "challenge", "input_chan_bindings", NULL}; + struct gss_channel_bindings_struct *channel_bindings; + static char *kwlist[] = {"state", "challenge", "channel_bindings", NULL}; int result = 0; - if (!PyArg_ParseTupleAndKeywords(args, keywds, "Os|O", kwlist, &pystate, &challenge, &pychan_bindings)) { + if (! PyArg_ParseTupleAndKeywords(args, keywds, "Os|O", kwlist, &pystate, &challenge, &pychan_bindings)) { return NULL; } @@ -233,16 +253,16 @@ static PyObject *authGSSClientStep(PyObject *self, PyObject *args, PyObject* key } if (pychan_bindings == NULL) { - input_chan_bindings = GSS_C_NO_CHANNEL_BINDINGS; + channel_bindings = GSS_C_NO_CHANNEL_BINDINGS; } else { if (!PyCheck(pychan_bindings)) { PyErr_SetString(PyExc_TypeError, "Expected a gss_channel_bindings_struct object"); return NULL; } - input_chan_bindings = PyGet(pychan_bindings, struct gss_channel_bindings_struct); + channel_bindings = PyGet(pychan_bindings, struct gss_channel_bindings_struct); } - result = authenticate_gss_client_step(state, challenge, input_chan_bindings); + result = authenticate_gss_client_step(state, challenge, channel_bindings); if (result == AUTH_GSS_ERROR) { return NULL; } @@ -590,7 +610,7 @@ static PyMethodDef KerberosMethods[] = { "Do a GSSAPI wrap."}, {"authGSSClientUnwrap", authGSSClientUnwrap, METH_VARARGS, "Do a GSSAPI unwrap."}, - {"buildChannelBindingsStruct", (PyCFunction)buildChannelBindingsStruct, METH_VARARGS | METH_KEYWORDS, + {"channelBindings", (PyCFunction)channelBindings, METH_VARARGS | METH_KEYWORDS, "Build the Channel Bindings Structure based on the input."}, #ifdef GSSAPI_EXT {"authGSSClientWrapIov", authGSSClientWrapIov, METH_VARARGS, @@ -681,6 +701,29 @@ void initkerberos(void) PyDict_SetItemString(d, "GSS_MECH_OID_KRB5", PyNew(&krb5_mech_oid, NULL)); PyDict_SetItemString(d, "GSS_MECH_OID_SPNEGO", PyNew(&spnego_mech_oid, NULL)); + PyDict_SetItemString(d, "GSS_C_AF_UNSPEC", PyInt_FromLong(GSS_C_AF_UNSPEC)); + PyDict_SetItemString(d, "GSS_C_AF_LOCAL", PyInt_FromLong(GSS_C_AF_LOCAL)); + PyDict_SetItemString(d, "GSS_C_AF_INET", PyInt_FromLong(GSS_C_AF_INET)); + PyDict_SetItemString(d, "GSS_C_AF_IMPLINK", PyInt_FromLong(GSS_C_AF_IMPLINK)); + PyDict_SetItemString(d, "GSS_C_AF_PUP", PyInt_FromLong(GSS_C_AF_PUP)); + PyDict_SetItemString(d, "GSS_C_AF_CHAOS", PyInt_FromLong(GSS_C_AF_CHAOS)); + PyDict_SetItemString(d, "GSS_C_AF_NS", PyInt_FromLong(GSS_C_AF_NS)); + PyDict_SetItemString(d, "GSS_C_AF_NBS", PyInt_FromLong(GSS_C_AF_NBS)); + PyDict_SetItemString(d, "GSS_C_AF_ECMA", PyInt_FromLong(GSS_C_AF_ECMA)); + PyDict_SetItemString(d, "GSS_C_AF_DATAKIT", PyInt_FromLong(GSS_C_AF_DATAKIT)); + PyDict_SetItemString(d, "GSS_C_AF_CCITT", PyInt_FromLong(GSS_C_AF_CCITT)); + PyDict_SetItemString(d, "GSS_C_AF_SNA", PyInt_FromLong(GSS_C_AF_SNA)); + PyDict_SetItemString(d, "GSS_C_AF_DECnet", PyInt_FromLong(GSS_C_AF_DECnet)); + PyDict_SetItemString(d, "GSS_C_AF_DLI", PyInt_FromLong(GSS_C_AF_DLI)); + PyDict_SetItemString(d, "GSS_C_AF_LAT", PyInt_FromLong(GSS_C_AF_LAT)); + PyDict_SetItemString(d, "GSS_C_AF_HYLINK", PyInt_FromLong(GSS_C_AF_HYLINK)); + PyDict_SetItemString(d, "GSS_C_AF_APPLETALK", PyInt_FromLong(GSS_C_AF_APPLETALK)); + PyDict_SetItemString(d, "GSS_C_AF_BSC", PyInt_FromLong(GSS_C_AF_BSC)); + PyDict_SetItemString(d, "GSS_C_AF_DSS", PyInt_FromLong(GSS_C_AF_DSS)); + PyDict_SetItemString(d, "GSS_C_AF_OSI", PyInt_FromLong(GSS_C_AF_OSI)); + PyDict_SetItemString(d, "GSS_C_AF_X25", PyInt_FromLong(GSS_C_AF_X25)); + PyDict_SetItemString(d, "GSS_C_AF_NULLADDR", PyInt_FromLong(GSS_C_AF_NULLADDR)); + error: if (PyErr_Occurred()) PyErr_SetString(PyExc_ImportError, "kerberos: init failed"); diff --git a/src/kerberosgss.c b/src/kerberosgss.c index 62c558e..0428426 100644 --- a/src/kerberosgss.c +++ b/src/kerberosgss.c @@ -205,7 +205,7 @@ int authenticate_gss_client_clean(gss_client_state *state) return ret; } -int authenticate_gss_client_step(gss_client_state* state, const char* challenge, struct gss_channel_bindings_struct* input_chan_bindings) +int authenticate_gss_client_step(gss_client_state* state, const char* challenge, struct gss_channel_bindings_struct* channel_bindings) { OM_uint32 maj_stat; OM_uint32 min_stat; @@ -238,7 +238,7 @@ int authenticate_gss_client_step(gss_client_state* state, const char* challenge, state->mech_oid, (OM_uint32)state->gss_flags, 0, - input_chan_bindings, + channel_bindings, &input_token, NULL, &output_token, diff --git a/src/kerberosgss.h b/src/kerberosgss.h index ea4f4d5..3d5a96f 100644 --- a/src/kerberosgss.h +++ b/src/kerberosgss.h @@ -56,7 +56,7 @@ char* server_principal_details(const char* service, const char* hostname); int authenticate_gss_client_init(const char* service, const char* principal, long int gss_flags, gss_OID mech_oid, gss_client_state* state); int authenticate_gss_client_clean(gss_client_state *state); -int authenticate_gss_client_step(gss_client_state *state, const char *challenge, struct gss_channel_bindings_struct *input_chan_bindings); +int authenticate_gss_client_step(gss_client_state *state, const char *challenge, struct gss_channel_bindings_struct *channel_bindings); int authenticate_gss_client_unwrap(gss_client_state* state, const char* challenge); int authenticate_gss_client_wrap(gss_client_state* state, const char* challenge, const char* user, int protect); #ifdef GSSAPI_EXT
0
088d4538a746f0346b46eba03998045e6c694ada
02strich
pykerberos
Fix double increase of refcount in Init methods
commit 088d4538a746f0346b46eba03998045e6c694ada Author: Stefan Richter <[email protected]> Date: Mon Nov 9 19:48:43 2015 -0800 Fix double increase of refcount in Init methods diff --git a/src/kerberos.c b/src/kerberos.c index 8be7348..528f541 100644 --- a/src/kerberos.c +++ b/src/kerberos.c @@ -136,7 +136,7 @@ static PyObject* authGSSClientInit(PyObject* self, PyObject* args, PyObject* key return NULL; } - return Py_BuildValue("(iO)", result, pystate); + return Py_BuildValue("(iN)", result, pystate); } static PyObject *authGSSClientClean(PyObject *self, PyObject *args) { @@ -389,7 +389,7 @@ static PyObject *authGSSServerInit(PyObject *self, PyObject *args) { return NULL; } - return Py_BuildValue("(iO)", result, pystate); + return Py_BuildValue("(iN)", result, pystate); } static PyObject *authGSSServerClean(PyObject *self, PyObject *args) {
0
693182594e7447f97cf4a3c3c63cfcc63b5fa298
02strich
pykerberos
Merge pull request #21 from nitzmahone/explicit_principal replace explicit client credentials to gss_init_sec_context
commit 693182594e7447f97cf4a3c3c63cfcc63b5fa298 Merge: 7c4df6b 22ad6f3 Author: Stefan Richter <[email protected]> Date: Thu May 26 11:49:41 2016 -0700 Merge pull request #21 from nitzmahone/explicit_principal replace explicit client credentials to gss_init_sec_context
0
6eabbd87690948f7aa489e28f2c216130218d465
02strich
pykerberos
Don't free stack allocated buffer #15
commit 6eabbd87690948f7aa489e28f2c216130218d465 Author: Bernie Hackett <[email protected]> Date: Thu Feb 25 15:22:51 2016 -0800 Don't free stack allocated buffer #15 diff --git a/src/kerberosgss.c b/src/kerberosgss.c index 86788da..99436c8 100644 --- a/src/kerberosgss.c +++ b/src/kerberosgss.c @@ -603,7 +603,7 @@ end: if (output_token.value) gss_release_buffer(&min_stat, &output_token); - if (input_token.value) + if (!user && input_token.value) gss_release_buffer(&min_stat, &input_token); return ret;
0
848ce222ec14870648e3e0b36f37ddc4d2fb653c
02strich
pykerberos
fix typos
commit 848ce222ec14870648e3e0b36f37ddc4d2fb653c Author: Stefan Richter <[email protected]> Date: Sun Nov 8 21:09:29 2015 -0800 fix typos diff --git a/src/kerberos.c b/src/kerberos.c index ff75dee..8be7348 100644 --- a/src/kerberos.c +++ b/src/kerberos.c @@ -140,10 +140,8 @@ static PyObject* authGSSClientInit(PyObject* self, PyObject* args, PyObject* key } static PyObject *authGSSClientClean(PyObject *self, PyObject *args) { -#if PY_MAJOR_VERSION >= 3 - PyErr_WarnEx(PyExc_RuntimeError, "kerberos.authGSSClientClean is deprecated.", 2); - return Py_BuildValue("i", AUTH_GSS_COMPLETE); -#endif + PyErr_WarnEx(PyExc_RuntimeError, "kerberos.authGSSClientClean is deprecated.", 2); + return Py_BuildValue("i", AUTH_GSS_COMPLETE); } static PyObject *authGSSClientStep(PyObject *self, PyObject *args) { @@ -395,7 +393,6 @@ static PyObject *authGSSServerInit(PyObject *self, PyObject *args) { } static PyObject *authGSSServerClean(PyObject *self, PyObject *args) { -#if PY_MAJOR_VERSION >= 3 PyErr_WarnEx(PyExc_RuntimeError, "kerberos.authGSSServerClean is deprecated.", 2); return Py_BuildValue("i", AUTH_GSS_COMPLETE); }
0
482e1418af542395f59df6780c6d816f86ac3429
02strich
pykerberos
C89 compliance.
commit 482e1418af542395f59df6780c6d816f86ac3429 Author: A. Jesse Jiryu Davis <[email protected]> Date: Tue Mar 25 11:36:47 2014 -0400 C89 compliance. diff --git a/src/base64.c b/src/base64.c index 877379f..2272ff6 100644 --- a/src/base64.c +++ b/src/base64.c @@ -55,8 +55,8 @@ char *base64_encode(const unsigned char *value, size_t vlen) } if (vlen > 0) { - *out++ = basis_64[value[0] >> 2]; unsigned char oval = (value[0] << 4) & 0x30; + *out++ = basis_64[value[0] >> 2]; if (vlen > 1) oval |= value[1] >> 4; *out++ = basis_64[oval]; *out++ = (vlen < 2) ? '=' : basis_64[(value[1] << 2) & 0x3C]; @@ -74,12 +74,11 @@ char *base64_encode(const unsigned char *value, size_t vlen) // (result) : new unsigned char[] - decoded result unsigned char *base64_decode(const char *value, size_t *rlen) { - *rlen = 0; int c1, c2, c3, c4; - size_t vlen = strlen(value); unsigned char *result =(unsigned char *)malloc((vlen * 3) / 4 + 1); unsigned char *out = result; + *rlen = 0; while (1) { diff --git a/src/kerberosgss.c b/src/kerberosgss.c index 158b55c..67f47b9 100644 --- a/src/kerberosgss.c +++ b/src/kerberosgss.c @@ -256,6 +256,7 @@ int authenticate_gss_client_step(gss_client_state* state, const char* challenge) // Try to get the user name if we have completed all GSS operations if (ret == AUTH_GSS_COMPLETE) { + gss_buffer_desc name_token; gss_name_t gssuser = GSS_C_NO_NAME; maj_stat = gss_inquire_context(&min_stat, state->context, &gssuser, NULL, NULL, NULL, NULL, NULL, NULL); if (GSS_ERROR(maj_stat)) @@ -265,7 +266,6 @@ int authenticate_gss_client_step(gss_client_state* state, const char* challenge) goto end; } - gss_buffer_desc name_token; name_token.length = 0; maj_stat = gss_display_name(&min_stat, gssuser, &name_token, NULL); if (GSS_ERROR(maj_stat)) @@ -433,6 +433,7 @@ int authenticate_gss_server_init(const char *service, gss_server_state *state) { OM_uint32 maj_stat; OM_uint32 min_stat; + size_t service_len; gss_buffer_desc name_token = GSS_C_EMPTY_BUFFER; int ret = AUTH_GSS_COMPLETE; @@ -446,7 +447,7 @@ int authenticate_gss_server_init(const char *service, gss_server_state *state) state->response = NULL; // Server name may be empty which means we aren't going to create our own creds - size_t service_len = strlen(service); + service_len = strlen(service); if (service_len != 0) { // Import server name first
0
7c4df6bf9ca85a0861b8cfc6da49860cfcab65b4
02strich
pykerberos
Merge pull request #16 from behackett/gsswrapfix Don't free stack allocated buffer #15
commit 7c4df6bf9ca85a0861b8cfc6da49860cfcab65b4 Merge: c0daca6 6eabbd8 Author: Stefan Richter <[email protected]> Date: Sun Feb 28 19:35:39 2016 -0800 Merge pull request #16 from behackett/gsswrapfix Don't free stack allocated buffer #15
0
b3db56977fa948a2e3eb99d4b3cce8d431e40677
02strich
pykerberos
DSP-1005
commit b3db56977fa948a2e3eb99d4b3cce8d431e40677 Author: Ben Gamble <[email protected]> Date: Thu Jan 31 00:55:19 2013 +0000 DSP-1005 diff --git a/pysrc/kerberos.py b/pysrc/kerberos.py index 1fed7e8..8c6a712 100644 --- a/pysrc/kerberos.py +++ b/pysrc/kerberos.py @@ -143,6 +143,14 @@ def authGSSClientResponse(context): @return: a string containing the base64-encoded client data to be sent to the server. """ +def authGSSClientResponseConf(context): + """ + Returns 1 if confidentiality was enabled in the previously unwrapped buffer. 0 otherwise. + + @param context: the context object returned from authGSSClientInit. + @return: an integer representing the confidentiality of the previously unwrapped buffer. + """ + def authGSSClientUserName(context): """ Get the user name of the principal authenticated via the now complete GSSAPI client-side operations. diff --git a/src/kerberos.c b/src/kerberos.c index d65c7ff..bf55b27 100644 --- a/src/kerberos.c +++ b/src/kerberos.c @@ -158,6 +158,26 @@ static PyObject *authGSSClientStep(PyObject *self, PyObject *args) return Py_BuildValue("i", result); } +static PyObject *authGSSClientResponseConf(PyObject *self, PyObject *args) +{ + gss_client_state *state; + PyObject *pystate; + + if (!PyArg_ParseTuple(args, "O", &pystate)) + return NULL; + + if (!PyCObject_Check(pystate)) { + PyErr_SetString(PyExc_TypeError, "Expected a context object"); + return NULL; + } + + state = (gss_client_state *)PyCObject_AsVoidPtr(pystate); + if (state == NULL) + return NULL; + + return Py_BuildValue("i", state->responseConf); +} + static PyObject *authGSSClientResponse(PyObject *self, PyObject *args) { gss_client_state *state; @@ -230,9 +250,10 @@ static PyObject *authGSSClientWrap(PyObject *self, PyObject *args) PyObject *pystate; char *challenge = NULL; char *user = NULL; + int protect = 0; int result = 0; - if (!PyArg_ParseTuple(args, "Os|z", &pystate, &challenge, &user)) + if (!PyArg_ParseTuple(args, "Os|zi", &pystate, &challenge, &user, &protect)) return NULL; if (!PyCObject_Check(pystate)) { @@ -244,7 +265,7 @@ static PyObject *authGSSClientWrap(PyObject *self, PyObject *args) if (state == NULL) return NULL; - result = authenticate_gss_client_wrap(state, challenge, user); + result = authenticate_gss_client_wrap(state, challenge, user, protect); if (result == AUTH_GSS_ERROR) return NULL; @@ -398,6 +419,8 @@ static PyMethodDef KerberosMethods[] = { "Do a client-side GSSAPI step."}, {"authGSSClientResponse", authGSSClientResponse, METH_VARARGS, "Get the response from the last client-side GSSAPI step."}, + {"authGSSClientResponseConf", authGSSClientResponseConf, METH_VARARGS, + "return 1 if confidentiality was set in the last unwrapped buffer, 0 otherwise."}, {"authGSSClientUserName", authGSSClientUserName, METH_VARARGS, "Get the user name from the last client-side GSSAPI step."}, {"authGSSServerInit", authGSSServerInit, METH_VARARGS, diff --git a/src/kerberosgss.c b/src/kerberosgss.c index af8abc1..158b55c 100644 --- a/src/kerberosgss.c +++ b/src/kerberosgss.c @@ -302,12 +302,14 @@ int authenticate_gss_client_unwrap(gss_client_state *state, const char *challeng gss_buffer_desc input_token = GSS_C_EMPTY_BUFFER; gss_buffer_desc output_token = GSS_C_EMPTY_BUFFER; int ret = AUTH_GSS_CONTINUE; + int conf = 0; // Always clear out the old response if (state->response != NULL) { free(state->response); state->response = NULL; + state->responseConf = 0; } // If there is a challenge (data from the server) we need to give it to GSS @@ -323,7 +325,7 @@ int authenticate_gss_client_unwrap(gss_client_state *state, const char *challeng state->context, &input_token, &output_token, - NULL, + &conf, NULL); if (maj_stat != GSS_S_COMPLETE) @@ -339,6 +341,7 @@ int authenticate_gss_client_unwrap(gss_client_state *state, const char *challeng if (output_token.length) { state->response = base64_encode((const unsigned char *)output_token.value, output_token.length); + state->responseConf = conf; maj_stat = gss_release_buffer(&min_stat, &output_token); } end: @@ -349,7 +352,7 @@ end: return ret; } -int authenticate_gss_client_wrap(gss_client_state* state, const char* challenge, const char* user) +int authenticate_gss_client_wrap(gss_client_state* state, const char* challenge, const char* user, int protect) { OM_uint32 maj_stat; OM_uint32 min_stat; @@ -400,7 +403,7 @@ int authenticate_gss_client_wrap(gss_client_state* state, const char* challenge, // Do GSSAPI wrap maj_stat = gss_wrap(&min_stat, state->context, - 0, + protect, GSS_C_QOP_DEFAULT, &input_token, NULL, diff --git a/src/kerberosgss.h b/src/kerberosgss.h index 7d1f6e3..1bcefca 100644 --- a/src/kerberosgss.h +++ b/src/kerberosgss.h @@ -35,6 +35,7 @@ typedef struct { gss_cred_id_t client_creds; char* username; char* response; + int responseConf; } gss_client_state; typedef struct { @@ -54,7 +55,7 @@ int authenticate_gss_client_init(const char* service, const char* principal, lon int authenticate_gss_client_clean(gss_client_state *state); int authenticate_gss_client_step(gss_client_state *state, const char *challenge); int authenticate_gss_client_unwrap(gss_client_state* state, const char* challenge); -int authenticate_gss_client_wrap(gss_client_state* state, const char* challenge, const char* user); +int authenticate_gss_client_wrap(gss_client_state* state, const char* challenge, const char* user, int protect); int authenticate_gss_server_init(const char* service, gss_server_state* state); int authenticate_gss_server_clean(gss_server_state *state);
0
481fc62b286fc2f1a5e8286e4027136e33493e04
02strich
pykerberos
Merge pull request #23 from dims/fix-type-error Fix TypeError when krb5-config is not present
commit 481fc62b286fc2f1a5e8286e4027136e33493e04 Merge: c74fce1 c81d434 Author: Stefan Richter <[email protected]> Date: Thu Jun 2 19:19:03 2016 -0700 Merge pull request #23 from dims/fix-type-error Fix TypeError when krb5-config is not present
0
c7c1d008b5afa02043303e6468cda82a45dc3f8c
1up-lab
OneupUploaderBundle
Merge branch 'validationEventWithResponse' of git://github.com/derpue/OneupUploaderBundle into derpue-validationEventWithResponse
commit c7c1d008b5afa02043303e6468cda82a45dc3f8c Merge: c70ac38 a4eca39 Author: David Greminger <[email protected]> Date: Tue Nov 21 17:10:34 2017 +0100 Merge branch 'validationEventWithResponse' of git://github.com/derpue/OneupUploaderBundle into derpue-validationEventWithResponse
0
beb16992f788f9fecfd1e6be214f0a51e3a420ea
1up-lab
OneupUploaderBundle
Test the filesystem storage.
commit beb16992f788f9fecfd1e6be214f0a51e3a420ea Author: Jim Schmid <[email protected]> Date: Sat Apr 6 20:36:52 2013 +0200 Test the filesystem storage. diff --git a/Tests/Uploader/Storage/FilesystemStorageTest.php b/Tests/Uploader/Storage/FilesystemStorageTest.php new file mode 100644 index 0000000..7560a79 --- /dev/null +++ b/Tests/Uploader/Storage/FilesystemStorageTest.php @@ -0,0 +1,50 @@ +<?php + +namespace Oneup\UploaderBundle\Tests\Uploader\Storage; + +use Symfony\Component\Finder\Finder; +use Symfony\Component\Filesystem\Filesystem; +use Symfony\Component\HttpFoundation\File\UploadedFile; +use Oneup\UploaderBundle\Uploader\Storage\FilesystemStorage; + +class FilesystemStorageTest extends \PHPUnit_Framework_TestCase +{ + protected $directory; + protected $file; + + public function setUp() + { + $this->directory = sys_get_temp_dir() . '/storage'; + + // create temporary file + $this->file = tempnam(sys_get_temp_dir(), 'uploader'); + + $pointer = fopen($this->file, 'w+'); + fwrite($pointer, str_repeat('A', 1024), 1024); + fclose($pointer); + } + + public function testUpload() + { + $payload = new UploadedFile($this->file, 'grumpycat.jpeg', null, null, null, true); + $storage = new FilesystemStorage($this->directory); + $storage->upload($payload, 'notsogrumpyanymore.jpeg'); + + $finder = new Finder(); + $finder->in($this->directory)->files(); + + $this->assertCount(1, $finder); + + foreach($finder as $file) + { + $this->assertEquals($file->getFilename(), 'notsogrumpyanymore.jpeg'); + $this->assertEquals($file->getSize(), 1024); + } + } + + public function tearDown() + { + $filesystem = new Filesystem(); + $filesystem->remove($this->directory); + } +} \ No newline at end of file
0
c4421355b4916617d4f7b570f2c3cb7c5f887160
1up-lab
OneupUploaderBundle
Removed an incorrect downgrade of max_size. This fixes the following situation: You are using chunked uploads. The total size of the file is 12MB, whereas `min(upload_max_size, post_max_size)` is limited to 8MB. The The downgrading is still implemented. If you wish to gracefully downgrade max_size, set the configuration value to -1. This addresses #35.
commit c4421355b4916617d4f7b570f2c3cb7c5f887160 Author: Jim Schmid <[email protected]> Date: Thu Jul 25 13:13:20 2013 +0200 Removed an incorrect downgrade of max_size. This fixes the following situation: You are using chunked uploads. The total size of the file is 12MB, whereas `min(upload_max_size, post_max_size)` is limited to 8MB. The The downgrading is still implemented. If you wish to gracefully downgrade max_size, set the configuration value to -1. This addresses #35. diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index cbf59dd..8543d7d 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -72,7 +72,10 @@ class Configuration implements ConfigurationInterface ->prototype('scalar')->end() ->end() ->scalarNode('error_handler')->defaultValue('oneup_uploader.error_handler.noop')->end() - ->scalarNode('max_size')->defaultValue(\PHP_INT_MAX)->end() + ->scalarNode('max_size') + ->defaultValue(\PHP_INT_MAX) + ->info('Set max_size to -1 for gracefully downgrade this number to the systems max upload size.') + ->end() ->booleanNode('use_orphanage')->defaultFalse()->end() ->booleanNode('enable_progress')->defaultFalse()->end() ->booleanNode('enable_cancelation')->defaultFalse()->end() diff --git a/DependencyInjection/OneupUploaderExtension.php b/DependencyInjection/OneupUploaderExtension.php index a7cdbba..4e9b72a 100644 --- a/DependencyInjection/OneupUploaderExtension.php +++ b/DependencyInjection/OneupUploaderExtension.php @@ -46,7 +46,10 @@ class OneupUploaderExtension extends Extension // handle mappings foreach ($config['mappings'] as $key => $mapping) { - $mapping['max_size'] = $this->getMaxUploadSize($mapping['max_size']); + $mapping['max_size'] = $mapping['max_size'] < 0 ? + $this->getMaxUploadSize($mapping['max_size']) : + $mapping['max_size'] + ; // create the storage service according to the configuration $storageService = null; diff --git a/Resources/doc/configuration_reference.md b/Resources/doc/configuration_reference.md index 52edb2d..7273963 100644 --- a/Resources/doc/configuration_reference.md +++ b/Resources/doc/configuration_reference.md @@ -8,6 +8,7 @@ oneup_uploader: chunks: maxage: 604800 directory: ~ + load_distribution: true orphanage: maxage: 604800 directory: ~ @@ -29,10 +30,13 @@ oneup_uploader: disallowed_extensions: [] allowed_mimetypes: [] disallowed_mimetypes: [] - error_handler: oneup_uploader.error_handler.noop + error_handler: oneup_uploader.error_handler.noop + + # Set max_size to -1 for gracefully downgrade this number to the systems max upload size. max_size: 9223372036854775807 use_orphanage: false enable_progress: false enable_cancelation: false namer: oneup_uploader.namer.uniqid + ``` diff --git a/Tests/DependencyInjection/OneupUploaderExtensionTest.php b/Tests/DependencyInjection/OneupUploaderExtensionTest.php index f68e764..1b09fbf 100644 --- a/Tests/DependencyInjection/OneupUploaderExtensionTest.php +++ b/Tests/DependencyInjection/OneupUploaderExtensionTest.php @@ -4,8 +4,59 @@ namespace Oneup\UploaderBundle\Tests\DependencyInjection; class OneupUploaderExtensionTest extends \PHPUnit_Framework_TestCase { - public function testDummyForSetup() + public function testValueToByteTransformer() { - $this->assertTrue(true); + $mock = $this->getMockBuilder('Oneup\UploaderBundle\DependencyInjection\OneupUploaderExtension') + ->disableOriginalConstructor() + ->getMock() + ; + + $method = new \ReflectionMethod( + 'Oneup\UploaderBundle\DependencyInjection\OneupUploaderExtension', + 'getValueInBytes' + ); + $method->setAccessible(true); + + $this->assertEquals(15, $method->invoke($mock, ' 15')); + $this->assertEquals(15, $method->invoke($mock, '15 ')); + + $this->assertEquals(1024, $method->invoke($mock, '1K')); + $this->assertEquals(2048, $method->invoke($mock, '2K')); + $this->assertEquals(1048576, $method->invoke($mock, '1M')); + $this->assertEquals(2097152, $method->invoke($mock, '2M')); + $this->assertEquals(1073741824, $method->invoke($mock, '1G')); + $this->assertEquals(2147483648, $method->invoke($mock, '2G')); + } + + public function testGetMaxUploadSize() + { + $mock = $this->getMockBuilder('Oneup\UploaderBundle\DependencyInjection\OneupUploaderExtension') + ->disableOriginalConstructor() + ->getMock() + ; + + $getMaxUploadSize = new \ReflectionMethod( + 'Oneup\UploaderBundle\DependencyInjection\OneupUploaderExtension', + 'getMaxUploadSize' + ); + + $getValueInBytes = new \ReflectionMethod( + 'Oneup\UploaderBundle\DependencyInjection\OneupUploaderExtension', + 'getValueInBytes' + ); + + $getMaxUploadSize->setAccessible(true); + $getValueInBytes->setAccessible(true); + + $store = array( + $getValueInBytes->invoke($mock, ini_get('upload_max_filesize')), + $getValueInBytes->invoke($mock, ini_get('post_max_size')) + ); + + $min = min($store); + + $this->assertEquals(0, $getMaxUploadSize->invoke($mock, 0)); + $this->assertEquals(min(10, $min), $getMaxUploadSize->invoke($mock, min(10, $min))); + $this->assertEquals(min(\PHP_INT_MAX, $min), $getMaxUploadSize->invoke($mock, min(\PHP_INT_MAX, $min))); } }
0
8a40040e78546ba95819480bc64e167827ad42e3
1up-lab
OneupUploaderBundle
Add Exception about the ValidationEvent It does not contain the response. (Is there any reason by the way)?
commit 8a40040e78546ba95819480bc64e167827ad42e3 Author: Schyzophrenic <[email protected]> Date: Sat May 10 20:51:19 2014 +0200 Add Exception about the ValidationEvent It does not contain the response. (Is there any reason by the way)? diff --git a/Resources/doc/response.md b/Resources/doc/response.md index bfef2ca..39d9968 100644 --- a/Resources/doc/response.md +++ b/Resources/doc/response.md @@ -1,7 +1,7 @@ Return custom data to the Frontend ================================== -There are some use cases where you need custom data to be returned to the frontend. For example the id of a generated Doctrine Entity or the like. To cover this, you can use `UploaderResponse` passed through all `Events`. +There are some use cases where you need custom data to be returned to the frontend. For example the id of a generated Doctrine Entity or the like. To cover this, you can use `UploaderResponse` passed through all `Events` (except the `ValidationEvent`). ```php namespace Acme\HelloBundle\EventListener; @@ -33,4 +33,4 @@ $response->setError($msg); > Do not use the keys `success` and `error` if you provide custom data, they will be overwritten by the internal properties of `UploaderResponse`. -Due to limitations of the `\ArrayAccess` regarding multi-dimensional array access, there is a method `addToOffset` which can be used to attach values to specific pathes in the array. \ No newline at end of file +Due to limitations of the `\ArrayAccess` regarding multi-dimensional array access, there is a method `addToOffset` which can be used to attach values to specific pathes in the array.
0
e7b632698fead9ca6e15bf567aac82249bbd97c4
1up-lab
OneupUploaderBundle
Update frontend_fancyupload.md Added a note about the minimal example.
commit e7b632698fead9ca6e15bf567aac82249bbd97c4 Author: Jim Schmid <[email protected]> Date: Fri Apr 12 12:22:04 2013 +0300 Update frontend_fancyupload.md Added a note about the minimal example. diff --git a/Resources/doc/frontend_fancyupload.md b/Resources/doc/frontend_fancyupload.md index bad221a..da918c2 100644 --- a/Resources/doc/frontend_fancyupload.md +++ b/Resources/doc/frontend_fancyupload.md @@ -3,6 +3,8 @@ Use FancyUpload Download [FancyUpload](http://digitarald.de/project/fancyupload/) and include it in your template. Connect the `url` property to the dynamic route `_uploader_{mapping_name}` and include the FlashUploader file (`path`). +> If you have any idea on how to make a minimal example about the usage of FancyUpload, consider creating a pull-request. + ```html <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/mootools/1.2.2/mootools.js"></script> @@ -103,4 +105,4 @@ oneup_uploader: frontend: fancyupload ``` -Be sure to check out the [official manual](http://digitarald.de/project/fancyupload/) for details on the configuration. \ No newline at end of file +Be sure to check out the [official manual](http://digitarald.de/project/fancyupload/) for details on the configuration.
0
8e21e8100a4dba50a1f2175e822d9e77e73cb918
1up-lab
OneupUploaderBundle
Added Upgrade Note about version 1.0.
commit 8e21e8100a4dba50a1f2175e822d9e77e73cb918 Author: Jim Schmid <[email protected]> Date: Wed Oct 23 15:27:21 2013 +0200 Added Upgrade Note about version 1.0. diff --git a/README.md b/README.md index a8b708b..0abe5c1 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ The entry point of the documentation can be found in the file `Resources/docs/in Upgrade Notes ------------- +* Version **v1.0.0** introduced some backward compatibility breaks. For a full list of changes, head to the [dedicated pull request](https://github.com/1up-lab/OneupUploaderBundle/pull/57). * If you're using chunked uploads consider upgrading from **v0.9.6** to **v0.9.7**. A critical issue was reported regarding the assembly of chunks. More information in ticket [#21](https://github.com/1up-lab/OneupUploaderBundle/issues/21#issuecomment-21560320). * Error management [changed](https://github.com/1up-lab/OneupUploaderBundle/pull/25) in Version **0.9.6**. You can now register an `ErrorHandler` per configured frontend. This comes bundled with some adjustments to the `blueimp` controller. More information is available in [the documentation](https://github.com/1up-lab/OneupUploaderBundle/blob/master/Resources/doc/custom_error_handler.md). * Event dispatching [changed](https://github.com/1up-lab/OneupUploaderBundle/commit/a408548b241f47af3539b2137c1817a21a51fde9) in Version **0.9.5**. The dispatching is now handled in the `upload*` functions. So if you have created your own implementation, be sure to remove the call to the `dispatchEvents` function, otherwise it will be called twice. Furthermore no `POST_UPLOAD` event will be fired anymore after uploading a chunk. You can get more information on this topic in the [documentation](https://github.com/1up-lab/OneupUploaderBundle/blob/master/Resources/doc/custom_logic.md#using-chunked-uploads).
0
56143a378caa904079ef1fdfbb14dc06535a8d09
1up-lab
OneupUploaderBundle
Moved file retrieval of MooController to a separte function in order to be able to test it.
commit 56143a378caa904079ef1fdfbb14dc06535a8d09 Author: Jim Schmid <[email protected]> Date: Fri May 31 17:40:37 2013 +0200 Moved file retrieval of MooController to a separte function in order to be able to test it. diff --git a/Controller/MooUploadController.php b/Controller/MooUploadController.php index 949663d..9dc64b4 100644 --- a/Controller/MooUploadController.php +++ b/Controller/MooUploadController.php @@ -21,24 +21,13 @@ class MooUploadController extends AbstractChunkedController $translator = $this->container->get('translator'); $response = new MooUploadResponse(); - $files = $request->files; $headers = $request->headers; + $file = $this->getUploadedFile($request); + // we have to get access to this object in another method $this->response = $response; - // create temporary file in systems temp dir - $tempFile = tempnam(sys_get_temp_dir(), 'uploader'); - $contents = file_get_contents('php://input'); - - // put data from php://input to temp file - file_put_contents($tempFile, $contents); - - $uploadFileName = sprintf('%s_%s', $headers->get('x-file-id'), $headers->get('x-file-name')); - - // create an uploaded file to upload - $file = new UploadedFile($tempFile, $uploadFileName, null, null, null, true); - // check if uploaded by chunks $chunked = $headers->get('content-length') < $headers->get('x-file-size'); @@ -119,4 +108,23 @@ class MooUploadController extends AbstractChunkedController return $ints; } + + protected function getUploadedFile(Request $request) + { + $headers = $request->headers; + + // create temporary file in systems temp dir + $tempFile = tempnam(sys_get_temp_dir(), 'uploader'); + $contents = file_get_contents('php://input'); + + // put data from php://input to temp file + file_put_contents($tempFile, $contents); + + $uploadFileName = sprintf('%s_%s', $headers->get('x-file-id'), $headers->get('x-file-name')); + + // create an uploaded file to upload + $file = new UploadedFile($tempFile, $uploadFileName, null, null, null, true); + + return $file; + } } \ No newline at end of file
0
c30b5a51b544533ace43d8bbbef3c8c4332e593c
1up-lab
OneupUploaderBundle
Namers don't know about the directory prefix, so it won't be passed to them.
commit c30b5a51b544533ace43d8bbbef3c8c4332e593c Author: Jim Schmid <[email protected]> Date: Sat Apr 6 10:25:46 2013 +0200 Namers don't know about the directory prefix, so it won't be passed to them. diff --git a/Uploader/Naming/NamerInterface.php b/Uploader/Naming/NamerInterface.php index 7bbf4d0..cf6fa30 100644 --- a/Uploader/Naming/NamerInterface.php +++ b/Uploader/Naming/NamerInterface.php @@ -6,5 +6,5 @@ use Symfony\Component\HttpFoundation\File\UploadedFile; interface NamerInterface { - public function name(UploadedFile $file, $prefix = null); + public function name(UploadedFile $file); } \ No newline at end of file diff --git a/Uploader/Naming/UniqidNamer.php b/Uploader/Naming/UniqidNamer.php index 07e04d9..1063205 100644 --- a/Uploader/Naming/UniqidNamer.php +++ b/Uploader/Naming/UniqidNamer.php @@ -9,8 +9,6 @@ class UniqidNamer implements NamerInterface { public function name(UploadedFile $file, $prefix = null) { - $prefix = !is_null($prefix) ? $prefix . '/' : ''; - - return sprintf('%s%s.%s', $prefix, uniqid(), $file->guessExtension()); + return sprintf('%s.%s', uniqid(), $file->guessExtension()); } } \ No newline at end of file
0
f9d820ab679f7c4942f90ea0e13847a23ef0a0d4
1up-lab
OneupUploaderBundle
BlueimpController: cast chunk index to integer (#379)
commit f9d820ab679f7c4942f90ea0e13847a23ef0a0d4 Author: mjedlick2 <[email protected]> Date: Mon Jul 6 16:54:07 2020 +0200 BlueimpController: cast chunk index to integer (#379) diff --git a/src/Controller/BlueimpController.php b/src/Controller/BlueimpController.php index a288759..126584a 100644 --- a/src/Controller/BlueimpController.php +++ b/src/Controller/BlueimpController.php @@ -76,7 +76,7 @@ class BlueimpController extends AbstractChunkedController // previously saved files, let me know. $size = ((int) $endByte + 1 - (int) $startByte); $last = ((int) $endByte + 1) === (int) $totalBytes; - $index = $last ? \PHP_INT_MAX : floor($startByte / $size); + $index = $last ? \PHP_INT_MAX : (int) floor($startByte / $size); // it is possible, that two clients send a file with the // exact same filename, therefore we have to add the session
0
545274acc30b688b4ad69346b822ad9c79ffd667
1up-lab
OneupUploaderBundle
Fixed wrong version constraint for symfony/framework-bundle
commit 545274acc30b688b4ad69346b822ad9c79ffd667 Author: David Greminger <[email protected]> Date: Thu Dec 10 15:39:40 2015 +0100 Fixed wrong version constraint for symfony/framework-bundle diff --git a/composer.json b/composer.json index 3d765c4..e9f912f 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ ], "require": { - "symfony/framework-bundle": "2.4.*", + "symfony/framework-bundle": "^2.4.0|~3.0", "symfony/http-kernel": "^2.4.0|~3.0", "symfony/finder": "^2.4.0|~3.0" },
0
b7596dd4204342ab663e1e2675bdd7d9e2efd55f
1up-lab
OneupUploaderBundle
Test uploadFiles() if orphanage path does not exist.
commit b7596dd4204342ab663e1e2675bdd7d9e2efd55f Author: Jim Schmid <[email protected]> Date: Sat Apr 6 21:35:58 2013 +0200 Test uploadFiles() if orphanage path does not exist. diff --git a/Tests/Uploader/Storage/OrphanageStorageTest.php b/Tests/Uploader/Storage/OrphanageStorageTest.php index c09caaf..070c677 100644 --- a/Tests/Uploader/Storage/OrphanageStorageTest.php +++ b/Tests/Uploader/Storage/OrphanageStorageTest.php @@ -100,6 +100,17 @@ class OrphanageStorageTest extends \PHPUnit_Framework_TestCase $this->assertCount($this->numberOfPayloads, $finder); } + public function testUploadAndFetchingIfDirectoryDoesNotExist() + { + $filesystem = new Filesystem(); + $filesystem->remove($this->tempDirectory); + + $files = $this->orphanage->uploadFiles(); + + $this->assertTrue(is_array($files)); + $this->assertCount(0, $files); + } + public function tearDown() { $filesystem = new Filesystem();
0
bbb79f2228e70a4845c60d32f125cfda1905667e
1up-lab
OneupUploaderBundle
Do not encourage to work on dev-master.
commit bbb79f2228e70a4845c60d32f125cfda1905667e Author: Jim Schmid <[email protected]> Date: Fri Aug 16 11:47:55 2013 +0200 Do not encourage to work on dev-master. diff --git a/Resources/doc/index.md b/Resources/doc/index.md index 4080132..8d85022 100644 --- a/Resources/doc/index.md +++ b/Resources/doc/index.md @@ -34,7 +34,7 @@ Add OneupUploaderBundle to your composer.json using the following construct: ```js { "require": { - "oneup/uploader-bundle": "dev-master" + "oneup/uploader-bundle": "0.9.*@dev" } } ```
0
579bad5541b97463bfc31275a0779de9a6f850f9
1up-lab
OneupUploaderBundle
CS fixes.
commit 579bad5541b97463bfc31275a0779de9a6f850f9 Author: Jim Schmid <[email protected]> Date: Sun Apr 28 10:50:48 2013 +0200 CS fixes. diff --git a/Uploader/Response/AbstractResponse.php b/Uploader/Response/AbstractResponse.php index 1e97d50..c6b9145 100644 --- a/Uploader/Response/AbstractResponse.php +++ b/Uploader/Response/AbstractResponse.php @@ -19,10 +19,12 @@ abstract class AbstractResponse implements ResponseInterface { is_null($offset) ? $this->data[] = $value : $this->data[$offset] = $value; } + public function offsetExists($offset) { return isset($this->data[$offset]); } + public function offsetUnset($offset) { unset($this->data[$offset]);
0
160c9a163d34b03c5413cee193743bc0407471f1
1up-lab
OneupUploaderBundle
Update custom_namer.md
commit 160c9a163d34b03c5413cee193743bc0407471f1 Author: mitom <[email protected]> Date: Fri Oct 11 10:50:13 2013 +0200 Update custom_namer.md diff --git a/Resources/doc/custom_namer.md b/Resources/doc/custom_namer.md index 4aaeabc..9b59e58 100644 --- a/Resources/doc/custom_namer.md +++ b/Resources/doc/custom_namer.md @@ -12,19 +12,19 @@ First, create a custom namer which implements ```Oneup\UploaderBundle\Uploader\N namespace Acme\DemoBundle; -use Symfony\Component\HttpFoundation\File\UploadedFile; +use Oneup\UploaderBundle\Uploader\File\FileInterface; use Oneup\UploaderBundle\Uploader\Naming\NamerInterface; class CatNamer implements NamerInterface { - public function name(UploadedFile $file) + public function name(FileInterface $file) { return 'grumpycat.jpg'; } } ``` -To match the `NamerInterface` you have to implement the function `name()` which expects an `UploadedFile` and should return a string representing the name of the given file. The example above would name every file _grumpycat.jpg_ and is therefore not very useful. +To match the `NamerInterface` you have to implement the function `name()` which expects an `FileInterface` and should return a string representing the name of the given file. The example above would name every file _grumpycat.jpg_ and is therefore not very useful. Next, register your created namer as a service in your `services.xml`
0
402976688c97e35a696f133a729732ac726d7666
1up-lab
OneupUploaderBundle
CS fixes for Uploader
commit 402976688c97e35a696f133a729732ac726d7666 Author: Jim Schmid <[email protected]> Date: Thu Jun 20 21:24:34 2013 +0200 CS fixes for Uploader diff --git a/Uploader/Chunk/ChunkManager.php b/Uploader/Chunk/ChunkManager.php index 14f070e..b1dcf23 100644 --- a/Uploader/Chunk/ChunkManager.php +++ b/Uploader/Chunk/ChunkManager.php @@ -7,7 +7,6 @@ use Symfony\Component\Finder\Finder; use Symfony\Component\Filesystem\Filesystem; use Oneup\UploaderBundle\Uploader\Chunk\ChunkManagerInterface; -use Oneup\UploaderBundle\Uploader\Naming\NamerInterface; class ChunkManager implements ChunkManagerInterface { @@ -15,43 +14,39 @@ class ChunkManager implements ChunkManagerInterface { $this->configuration = $configuration; } - + public function clear() { $system = new Filesystem(); $finder = new Finder(); - - try - { + + try { $finder->in($this->configuration['directory'])->date('<=' . -1 * (int) $this->configuration['maxage'] . 'seconds')->files(); - } - catch(\InvalidArgumentException $e) - { + } catch (\InvalidArgumentException $e) { // the finder will throw an exception of type InvalidArgumentException // if the directory he should search in does not exist // in that case we don't have anything to clean return; } - - foreach($finder as $file) - { + + foreach ($finder as $file) { $system->remove($file); } } - + public function addChunk($uuid, $index, UploadedFile $chunk, $original) { $filesystem = new Filesystem(); $path = sprintf('%s/%s', $this->configuration['directory'], $uuid); $name = sprintf('%s_%s', $index, $original); - + // create directory if it does not yet exist if(!$filesystem->exists($path)) $filesystem->mkdir(sprintf('%s/%s', $this->configuration['directory'], $uuid)); - + return $chunk->move($path, $name); } - + public function assembleChunks(\Traversable $chunks) { // I don't really get it why getIterator()->current() always @@ -59,34 +54,32 @@ class ChunkManager implements ChunkManagerInterface // in a rather unorthodox way. $i = 0; $base = null; - - foreach($chunks as $file) - { - if($i++ == 0) - { + + foreach ($chunks as $file) { + if ($i++ == 0) { $base = $file; - + // proceed with next files, as we have our // base data-container continue; } - + if(false === file_put_contents($base->getPathname(), file_get_contents($file->getPathname()), \FILE_APPEND | \LOCK_EX)) throw new \RuntimeException('Reassembling chunks failed.'); } - + return $base; } - + public function cleanup($path) { // cleanup $filesystem = new Filesystem(); $filesystem->remove($path); - + return true; } - + public function getChunks($uuid) { $finder = new Finder(); @@ -96,10 +89,10 @@ class ChunkManager implements ChunkManagerInterface $s = explode('_', $b->getBasename()); $t = (int) $t[0]; $s = (int) $s[0]; - + return $s < $t; }); - + return $finder; } -} \ No newline at end of file +} diff --git a/Uploader/Chunk/ChunkManagerInterface.php b/Uploader/Chunk/ChunkManagerInterface.php index f0059bb..009bfed 100644 --- a/Uploader/Chunk/ChunkManagerInterface.php +++ b/Uploader/Chunk/ChunkManagerInterface.php @@ -11,4 +11,4 @@ interface ChunkManagerInterface public function assembleChunks(\Traversable $chunks); public function cleanup($path); public function getChunks($uuid); -} \ No newline at end of file +} diff --git a/Uploader/Exception/ValidationException.php b/Uploader/Exception/ValidationException.php index ced7379..6d632f1 100644 --- a/Uploader/Exception/ValidationException.php +++ b/Uploader/Exception/ValidationException.php @@ -4,5 +4,5 @@ namespace Oneup\UploaderBundle\Uploader\Exception; class ValidationException extends \DomainException { - -} \ No newline at end of file + +} diff --git a/Uploader/Naming/NamerInterface.php b/Uploader/Naming/NamerInterface.php index cf6fa30..40ba4cd 100644 --- a/Uploader/Naming/NamerInterface.php +++ b/Uploader/Naming/NamerInterface.php @@ -7,4 +7,4 @@ use Symfony\Component\HttpFoundation\File\UploadedFile; interface NamerInterface { public function name(UploadedFile $file); -} \ No newline at end of file +} diff --git a/Uploader/Naming/UniqidNamer.php b/Uploader/Naming/UniqidNamer.php index af408d2..4c16b98 100644 --- a/Uploader/Naming/UniqidNamer.php +++ b/Uploader/Naming/UniqidNamer.php @@ -11,4 +11,4 @@ class UniqidNamer implements NamerInterface { return sprintf('%s.%s', uniqid(), $file->guessExtension()); } -} \ No newline at end of file +} diff --git a/Uploader/Orphanage/OrphanageManager.php b/Uploader/Orphanage/OrphanageManager.php index 053200f..b09dd25 100644 --- a/Uploader/Orphanage/OrphanageManager.php +++ b/Uploader/Orphanage/OrphanageManager.php @@ -10,38 +10,34 @@ class OrphanageManager { protected $config; protected $container; - + public function __construct(ContainerInterface $container, array $config) { $this->container = $container; $this->config = $config; } - + public function get($key) { return $this->container->get(sprintf('oneup_uploader.orphanage.%s', $key)); } - + public function clear() { $system = new Filesystem(); $finder = new Finder(); - - try - { + + try { $finder->in($this->config['directory'])->date('<=' . -1 * (int) $this->config['maxage'] . 'seconds')->files(); - } - catch(\InvalidArgumentException $e) - { + } catch (\InvalidArgumentException $e) { // the finder will throw an exception of type InvalidArgumentException // if the directory he should search in does not exist // in that case we don't have anything to clean return; } - - foreach($finder as $file) - { + + foreach ($finder as $file) { $system->remove($file); } } -} \ No newline at end of file +} diff --git a/Uploader/Response/AbstractResponse.php b/Uploader/Response/AbstractResponse.php index 11f67f7..561c7b7 100644 --- a/Uploader/Response/AbstractResponse.php +++ b/Uploader/Response/AbstractResponse.php @@ -7,7 +7,7 @@ use Oneup\UploaderBundle\Uploader\Response\ResponseInterface; abstract class AbstractResponse implements \ArrayAccess, ResponseInterface { protected $data; - + public function __construct() { $this->data = array(); @@ -17,19 +17,19 @@ abstract class AbstractResponse implements \ArrayAccess, ResponseInterface { is_null($offset) ? $this->data[] = $value : $this->data[$offset] = $value; } - + public function offsetExists($offset) { return isset($this->data[$offset]); } - + public function offsetUnset($offset) { unset($this->data[$offset]); } - + public function offsetGet($offset) { return isset($this->data[$offset]) ? $this->data[$offset] : null; } -} \ No newline at end of file +} diff --git a/Uploader/Response/EmptyResponse.php b/Uploader/Response/EmptyResponse.php index de61b42..0258586 100644 --- a/Uploader/Response/EmptyResponse.php +++ b/Uploader/Response/EmptyResponse.php @@ -5,9 +5,9 @@ namespace Oneup\UploaderBundle\Uploader\Response; use Oneup\UploaderBundle\Uploader\Response\AbstractResponse; class EmptyResponse extends AbstractResponse -{ +{ public function assemble() { return $this->data; } -} \ No newline at end of file +} diff --git a/Uploader/Response/FineUploaderResponse.php b/Uploader/Response/FineUploaderResponse.php index 4b47e3c..52c8570 100644 --- a/Uploader/Response/FineUploaderResponse.php +++ b/Uploader/Response/FineUploaderResponse.php @@ -8,15 +8,15 @@ class FineUploaderResponse extends AbstractResponse { protected $success; protected $error; - + public function __construct() { $this->success = true; $this->error = null; - + parent::__construct(); } - + public function assemble() { // explicitly overwrite success and error key @@ -24,37 +24,37 @@ class FineUploaderResponse extends AbstractResponse // frontend uploader $data = $this->data; $data['success'] = $this->success; - + if($this->success) unset($data['error']); - + if(!$this->success) $data['error'] = $this->error; - + return $data; } - + public function setSuccess($success) { $this->success = (bool) $success; - + return $this; } - + public function getSuccess() { return $this->success; } - + public function setError($msg) { $this->error = $msg; - + return $this; } - + public function getError() { return $this->error; } -} \ No newline at end of file +} diff --git a/Uploader/Response/MooUploadResponse.php b/Uploader/Response/MooUploadResponse.php index 44e0db4..bcb17b6 100644 --- a/Uploader/Response/MooUploadResponse.php +++ b/Uploader/Response/MooUploadResponse.php @@ -12,98 +12,98 @@ class MooUploadResponse extends AbstractResponse protected $error; protected $finish; protected $uploadedName; - + public function __construct() { $this->finish = true; $this->error = 0; - + parent::__construct(); } - + public function assemble() { $data = $this->data; - + $data['id'] = $this->id; $data['name'] = $this->name; $data['size'] = $this->size; $data['error'] = $this->error; $data['finish'] = $this->finish; $data['upload_name'] = $this->uploadedName; - + return $data; } - + public function setId($id) { $this->id = $id; - + return $this; } - + public function getId() { return $this->id; } - + public function setName($name) { $this->name = $name; - + return $this; } - + public function getName() { return $this->name; } - + public function setSize($size) { $this->size = $size; - + return $this; } - + public function getSize() { return $this->size; } - + public function setError($error) { $this->error = $error; - + return $this; } - + public function getError() { return $this->error; } - + public function setFinish($finish) { $this->finish = $finish; - + return $this; } - + public function getFinish() { return $this->finish; } - + public function setUploadedName($name) { $this->uploadedName = $name; - + return $this; } - + public function getUploadedName() { return $this->uploadedName; } -} \ No newline at end of file +} diff --git a/Uploader/Response/ResponseInterface.php b/Uploader/Response/ResponseInterface.php index 65fe303..135ef3a 100644 --- a/Uploader/Response/ResponseInterface.php +++ b/Uploader/Response/ResponseInterface.php @@ -5,4 +5,4 @@ namespace Oneup\UploaderBundle\Uploader\Response; interface ResponseInterface { public function assemble(); -} \ No newline at end of file +} diff --git a/Uploader/Storage/FilesystemStorage.php b/Uploader/Storage/FilesystemStorage.php index 4d52bb9..ed7931e 100644 --- a/Uploader/Storage/FilesystemStorage.php +++ b/Uploader/Storage/FilesystemStorage.php @@ -10,26 +10,26 @@ use Oneup\UploaderBundle\Uploader\Storage\StorageInterface; class FilesystemStorage implements StorageInterface { protected $directory; - + public function __construct($directory) { $this->directory = $directory; } - + public function upload(File $file, $name, $path = null) { $filesystem = new Filesystem(); - + $path = is_null($path) ? $name : sprintf('%s/%s', $path, $name); $path = sprintf('%s/%s', $this->directory, $path); - + // now that we have the correct path, compute the correct name // and target directory $targetName = basename($path); $targetDir = dirname($path); - + $file = $file->move($targetDir, $targetName); - + return $file; } -} \ No newline at end of file +} diff --git a/Uploader/Storage/GaufretteStorage.php b/Uploader/Storage/GaufretteStorage.php index 47306ab..ea8a6b3 100644 --- a/Uploader/Storage/GaufretteStorage.php +++ b/Uploader/Storage/GaufretteStorage.php @@ -13,42 +13,40 @@ use Oneup\UploaderBundle\Uploader\Storage\StorageInterface; class GaufretteStorage implements StorageInterface { protected $filesystem; - + public function __construct(Filesystem $filesystem) { $this->filesystem = $filesystem; } - + public function upload(File $file, $name, $path = null) { $path = is_null($path) ? $name : sprintf('%s/%s', $path, $name); - - if($this->filesystem->getAdapter() instanceof MetadataSupporter) - { + + if ($this->filesystem->getAdapter() instanceof MetadataSupporter) { $this->filesystem->getAdapter()->setMetadata($name, array('contentType' => $file->getMimeType())); } - + $src = new LocalStream($file->getPathname()); $dst = $this->filesystem->createStream($path); - + // this is a somehow ugly workaround introduced // because the stream-mode is not able to create // subdirectories. if(!$this->filesystem->has($path)) $this->filesystem->write($path, '', true); - + $src->open(new StreamMode('rb+')); $dst->open(new StreamMode('wb+')); - - while(!$src->eof()) - { + + while (!$src->eof()) { $data = $src->read(100000); $written = $dst->write($data); } - + $dst->close(); $src->close(); - + return $this->filesystem->get($path); } -} \ No newline at end of file +} diff --git a/Uploader/Storage/OrphanageStorage.php b/Uploader/Storage/OrphanageStorage.php index 1248f1c..38c4e96 100644 --- a/Uploader/Storage/OrphanageStorage.php +++ b/Uploader/Storage/OrphanageStorage.php @@ -17,62 +17,58 @@ class OrphanageStorage extends FilesystemStorage implements OrphanageStorageInte protected $session; protected $config; protected $type; - + public function __construct(StorageInterface $storage, SessionInterface $session, $config, $type) { parent::__construct($config['directory']); - + $this->storage = $storage; $this->session = $session; $this->config = $config; $this->type = $type; } - + public function upload(File $file, $name, $path = null) { if(!$this->session->isStarted()) throw new \RuntimeException('You need a running session in order to run the Orphanage.'); - + return parent::upload($file, $name, $this->getPath()); } - + public function uploadFiles() { $filesystem = new Filesystem(); - - try - { + + try { $files = $this->getFiles(); $return = array(); - - foreach($files as $file) - { + + foreach ($files as $file) { $return[] = $this->storage->upload(new File($file->getPathname()), str_replace($this->getFindPath(), '', $file)); } return $return; - } - catch(\Exception $e) - { + } catch (\Exception $e) { return array(); } } - + protected function getFiles() { $finder = new Finder(); $finder->in($this->getFindPath())->files(); - + return $finder; } - + protected function getPath() { return sprintf('%s/%s', $this->session->getId(), $this->type); } - + protected function getFindPath() { return sprintf('%s/%s', $this->config['directory'], $this->getPath()); } -} \ No newline at end of file +} diff --git a/Uploader/Storage/StorageInterface.php b/Uploader/Storage/StorageInterface.php index e4e3dce..090db1a 100644 --- a/Uploader/Storage/StorageInterface.php +++ b/Uploader/Storage/StorageInterface.php @@ -7,4 +7,4 @@ use Symfony\Component\HttpFoundation\File\File; interface StorageInterface { public function upload(File $file, $name, $path = null); -} \ No newline at end of file +}
0
55fc9c277c8e577514b37c816c1dab27a5fd193f
1up-lab
OneupUploaderBundle
Include mime type with file upload When reading the file mime type through php, the information is still in place. However, when using AWS S3, the uploaded object's metadata always defaults to "application/octet-stream" inside of AWS. Including the "mimetype" option with the "putstream" function seems to correct this problem; setting the AWS object to the correct content type.
commit 55fc9c277c8e577514b37c816c1dab27a5fd193f Author: Brandon Pearson <[email protected]> Date: Wed Dec 7 20:16:51 2016 -0600 Include mime type with file upload When reading the file mime type through php, the information is still in place. However, when using AWS S3, the uploaded object's metadata always defaults to "application/octet-stream" inside of AWS. Including the "mimetype" option with the "putstream" function seems to correct this problem; setting the AWS object to the correct content type. diff --git a/Uploader/Storage/FlysystemStorage.php b/Uploader/Storage/FlysystemStorage.php index 9a98720..aa2fa61 100644 --- a/Uploader/Storage/FlysystemStorage.php +++ b/Uploader/Storage/FlysystemStorage.php @@ -45,7 +45,9 @@ class FlysystemStorage implements StorageInterface } $stream = fopen($file->getPathname(), 'r+'); - $this->filesystem->putStream($name, $stream); + $this->filesystem->putStream($name, $stream, array( + 'mimetype' => $file->getMimeType() + )); if (is_resource($stream)) { fclose($stream); }
0
14eda43b90ac9d08485daf98017c67f1827920fd
1up-lab
OneupUploaderBundle
Merge pull request #276 from glukose/patch-1 Added example code for response return
commit 14eda43b90ac9d08485daf98017c67f1827920fd Merge: d9413ed f679316 Author: David Greminger <[email protected]> Date: Thu Feb 2 13:11:22 2017 +0100 Merge pull request #276 from glukose/patch-1 Added example code for response return
0
5d35826c408e0a48e01b081be90fcf7665348971
1up-lab
OneupUploaderBundle
Update README.md
commit 5d35826c408e0a48e01b081be90fcf7665348971 Author: Jim Schmid <[email protected]> Date: Fri Apr 12 18:32:17 2013 +0300 Update README.md diff --git a/README.md b/README.md index 292b3cb..821a85c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ OneupUploaderBundle =================== -The OneupUploaderBundle adds support for handling file uploads using one of the following Javascript libraries to your Symfony2 application: +The OneupUploaderBundle for Symfony2 adds support for handling file uploads using one of the following Javascript libraries, or [your own implementation](https://github.com/1up-lab/OneupUploaderBundle/blob/master/Resources/doc/index.md). * [FineUploader](http://fineuploader.com/) * [jQuery File Uploader](http://blueimp.github.io/jQuery-File-Upload/)
0
c9c4c1946b430f1d1226958176eb2a26d71cc5e4
1up-lab
OneupUploaderBundle
Removed unused variables on YUI3Controller.
commit c9c4c1946b430f1d1226958176eb2a26d71cc5e4 Author: Jim Schmid <[email protected]> Date: Fri Apr 12 11:25:42 2013 +0200 Removed unused variables on YUI3Controller. diff --git a/Controller/YUI3Controller.php b/Controller/YUI3Controller.php index 8ade2ec..b063e92 100644 --- a/Controller/YUI3Controller.php +++ b/Controller/YUI3Controller.php @@ -13,9 +13,6 @@ class YUI3Controller extends AbstractController public function upload() { $request = $this->container->get('request'); - $dispatcher = $this->container->get('event_dispatcher'); - $translator = $this->container->get('translator'); - $response = new EmptyResponse(); $files = $request->files;
0
fe51b5f18779f172b553105bf19b63ca916bdf15
1up-lab
OneupUploaderBundle
Changed name of ControllerTest as I'm going to implement the chunked upload test afterwards.
commit fe51b5f18779f172b553105bf19b63ca916bdf15 Author: Jim Schmid <[email protected]> Date: Sat Apr 6 17:01:16 2013 +0200 Changed name of ControllerTest as I'm going to implement the chunked upload test afterwards. diff --git a/Tests/Controller/ControllerTest.php b/Tests/Controller/ControllerUploadTest.php similarity index 98% rename from Tests/Controller/ControllerTest.php rename to Tests/Controller/ControllerUploadTest.php index bf433f9..7bd7fc8 100644 --- a/Tests/Controller/ControllerTest.php +++ b/Tests/Controller/ControllerUploadTest.php @@ -10,7 +10,7 @@ use Oneup\UploaderBundle\Uploader\Naming\UniqidNamer; use Oneup\UploaderBundle\Uploader\Storage\FilesystemStorage; use Oneup\UploaderBundle\Controller\UploaderController; -class ControllerTest extends \PHPUnit_Framework_TestCase +class ControllerUploadTest extends \PHPUnit_Framework_TestCase { protected $tempFile;
0
f41e06bf3252be7d661e11d4ab9b874971855eb7
1up-lab
OneupUploaderBundle
Add a link to flystem documenation
commit f41e06bf3252be7d661e11d4ab9b874971855eb7 Author: Shank <[email protected]> Date: Mon Sep 5 13:21:43 2016 -0700 Add a link to flystem documenation diff --git a/Resources/doc/index.md b/Resources/doc/index.md index 7b6601e..1b07234 100644 --- a/Resources/doc/index.md +++ b/Resources/doc/index.md @@ -137,6 +137,7 @@ some more advanced features. * [Return custom data to frontend](response.md) * [Enable chunked uploads](chunked_uploads.md) * [Using the Orphanage](orphanage.md) +* [Use Flysystem as storage layer](flysystem_storage.md) * [Use Gaufrette as storage layer](gaufrette_storage.md) * [Include your own Namer](custom_namer.md) * [Use custom error handlers](custom_error_handler.md)
0
cab0860a44d257dcc6a4a2b1f94d1237fe1765b6
1up-lab
OneupUploaderBundle
Refactored the way Chunks are reassembled. Removed a rather hacky way of determine which of the chunks to use as a base, and replaced it with an Iterator as mentioned in #21.
commit cab0860a44d257dcc6a4a2b1f94d1237fe1765b6 Author: Jim Schmid <[email protected]> Date: Mon Jun 24 14:08:30 2013 +0200 Refactored the way Chunks are reassembled. Removed a rather hacky way of determine which of the chunks to use as a base, and replaced it with an Iterator as mentioned in #21. diff --git a/Uploader/Chunk/ChunkManager.php b/Uploader/Chunk/ChunkManager.php index b1dcf23..f5bc733 100644 --- a/Uploader/Chunk/ChunkManager.php +++ b/Uploader/Chunk/ChunkManager.php @@ -49,23 +49,20 @@ class ChunkManager implements ChunkManagerInterface public function assembleChunks(\Traversable $chunks) { - // I don't really get it why getIterator()->current() always - // gives me a null-value, due to that I've to implement this - // in a rather unorthodox way. - $i = 0; - $base = null; - - foreach ($chunks as $file) { - if ($i++ == 0) { - $base = $file; - - // proceed with next files, as we have our - // base data-container - continue; - } + $iterator = $chunks->getIterator()->getInnerIterator(); + + $base = $iterator->current(); + $iterator->next(); + + while ($iterator->valid()) { - if(false === file_put_contents($base->getPathname(), file_get_contents($file->getPathname()), \FILE_APPEND | \LOCK_EX)) + $file = $iterator->current(); + + if (false === file_put_contents($base->getPathname(), file_get_contents($file->getPathname()), \FILE_APPEND | \LOCK_EX)) { throw new \RuntimeException('Reassembling chunks failed.'); + } + + $iterator->next(); } return $base;
0
f19277d0cf7fe3ce1ce7b7582149288f90fa134d
1up-lab
OneupUploaderBundle
Added a knp_gaufrette configuration with local adapters to documentation.
commit f19277d0cf7fe3ce1ce7b7582149288f90fa134d Author: Jim Schmid <[email protected]> Date: Sun Apr 7 20:22:07 2013 +0200 Added a knp_gaufrette configuration with local adapters to documentation. diff --git a/Resources/doc/gaufrette_storage.md b/Resources/doc/gaufrette_storage.md index 9dc6b51..4205957 100644 --- a/Resources/doc/gaufrette_storage.md +++ b/Resources/doc/gaufrette_storage.md @@ -42,6 +42,21 @@ public function registerBundles() ## Configure your Filesystems +```yml +knp_gaufrette: + adapters: + gallery: + local: + directory: %kernel.root_dir%/../web/uploads + create: true + + filesystems: + gallery: + adapter: gallery + + stream_wrapper: ~ +``` + ## Configure your mappings ```yml
0
f67931620e4c93876f55d892b211a53d7c0e7bfd
1up-lab
OneupUploaderBundle
Added example code for response return
commit f67931620e4c93876f55d892b211a53d7c0e7bfd Author: clément larrieu <[email protected]> Date: Thu Feb 2 11:59:17 2017 +0100 Added example code for response return diff --git a/Resources/doc/custom_logic.md b/Resources/doc/custom_logic.md index 1aa1cfd..3471492 100644 --- a/Resources/doc/custom_logic.md +++ b/Resources/doc/custom_logic.md @@ -31,6 +31,11 @@ class UploadListener public function onUpload(PostPersistEvent $event) { //... + + //if everything went fine + $response = $event->getResponse(); + $response['success'] = true; + return $response; } } ```
0
324d398a3eafa4f9cbeacc187a0a86d7bd18ca4a
1up-lab
OneupUploaderBundle
Added flysystem to also be a possible filesystem
commit 324d398a3eafa4f9cbeacc187a0a86d7bd18ca4a Author: Martin Aarhof <[email protected]> Date: Tue Jan 19 14:27:42 2016 +0100 Added flysystem to also be a possible filesystem diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 3374889..276ddf3 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -22,7 +22,7 @@ class Configuration implements ConfigurationInterface ->addDefaultsIfNotSet() ->children() ->enumNode('type') - ->values(array('filesystem', 'gaufrette')) + ->values(array('filesystem', 'gaufrette', 'flysystem')) ->defaultValue('filesystem') ->end() ->scalarNode('filesystem')->defaultNull()->end() @@ -65,7 +65,7 @@ class Configuration implements ConfigurationInterface ->children() ->scalarNode('service')->defaultNull()->end() ->enumNode('type') - ->values(array('filesystem', 'gaufrette')) + ->values(array('filesystem', 'gaufrette', 'flysystem')) ->defaultValue('filesystem') ->end() ->scalarNode('filesystem')->defaultNull()->end() diff --git a/DependencyInjection/OneupUploaderExtension.php b/DependencyInjection/OneupUploaderExtension.php index 7f35224..4a471c5 100644 --- a/DependencyInjection/OneupUploaderExtension.php +++ b/DependencyInjection/OneupUploaderExtension.php @@ -13,6 +13,10 @@ use Symfony\Component\DependencyInjection\Loader; class OneupUploaderExtension extends Extension { protected $storageServices = array(); + + /** + * @var ContainerBuilder + */ protected $container; protected $config; @@ -141,31 +145,44 @@ class OneupUploaderExtension extends Extension $config = &$this->config['chunks']['storage']; $storageClass = sprintf('%%oneup_uploader.chunks_storage.%s.class%%', $config['type']); - if ($config['type'] === 'filesystem') { - $config['directory'] = is_null($config['directory']) ? - sprintf('%s/uploader/chunks', $this->container->getParameter('kernel.cache_dir')) : - $this->normalizePath($config['directory']) - ; - - $this->container - ->register('oneup_uploader.chunks_storage', sprintf('%%oneup_uploader.chunks_storage.%s.class%%', $config['type'])) - ->addArgument($config['directory']) - ; - } else { - $this->registerGaufretteStorage( - 'oneup_uploader.chunks_storage', - $storageClass, $config['filesystem'], - $config['sync_buffer_size'], - $config['stream_wrapper'], - $config['prefix'] - ); - - $this->container->setParameter('oneup_uploader.orphanage.class', 'Oneup\UploaderBundle\Uploader\Storage\GaufretteOrphanageStorage'); - - // enforce load distribution when using gaufrette as chunk - // torage to avoid moving files forth-and-back - $this->config['chunks']['load_distribution'] = true; + + switch($config['type']) { + case 'filesystem': + $config['directory'] = is_null($config['directory']) ? + sprintf('%s/uploader/chunks', $this->container->getParameter('kernel.cache_dir')) : + $this->normalizePath($config['directory']) + ; + + $this->container + ->register('oneup_uploader.chunks_storage', sprintf('%%oneup_uploader.chunks_storage.%s.class%%', $config['type'])) + ->addArgument($config['directory']) + ; + break; + case 'gaufrette': + case 'flysystem': + $this->registerFilesystem( + $config['type'], + 'oneup_uploader.chunks_storage', + $storageClass, $config['filesystem'], + $config['sync_buffer_size'], + $config['stream_wrapper'], + $config['prefix'] + ); + + $this->container->setParameter( + 'oneup_uploader.orphanage.class', + sprintf('Oneup\UploaderBundle\Uploader\Storage\%sOrphanageStorage', ucfirst($config['type'])) + ); + + // enforce load distribution when using gaufrette as chunk + // torage to avoid moving files forth-and-back + $this->config['chunks']['load_distribution'] = true; + break; + default: + throw new \InvalidArgumentException(sprintf('Filesystem "%s" is invalid', $config['type'])); + break; } + } protected function createStorageService(&$config, $key, $orphanage = false) @@ -181,26 +198,31 @@ class OneupUploaderExtension extends Extension $storageName = sprintf('oneup_uploader.storage.%s', $key); $storageClass = sprintf('%%oneup_uploader.storage.%s.class%%', $config['type']); - if ($config['type'] == 'filesystem') { - $config['directory'] = is_null($config['directory']) ? - sprintf('%s/../web/uploads/%s', $this->container->getParameter('kernel.root_dir'), $key) : - $this->normalizePath($config['directory']) - ; - - $this->container - ->register($storageName, $storageClass) - ->addArgument($config['directory']) - ; - } - - if ($config['type'] == 'gaufrette') { - $this->registerGaufretteStorage( - $storageName, - $storageClass, - $config['filesystem'], - $config['sync_buffer_size'], - $config['stream_wrapper'] - ); + switch ($config['type']) { + case 'filesystem': + $config['directory'] = is_null($config['directory']) ? + sprintf('%s/../web/uploads/%s', $this->container->getParameter('kernel.root_dir'), $key) : + $this->normalizePath($config['directory']) + ; + + $this->container + ->register($storageName, $storageClass) + ->addArgument($config['directory']) + ; + break; + case 'gaufrette': + case 'flysystem': + $this->registerFilesystem( + $config['type'], + $storageName, + $storageClass, + $config['filesystem'], + $config['sync_buffer_size'], + $config['stream_wrapper'] + ); + break; + default: + break; } $storageService = new Reference($storageName); @@ -227,12 +249,22 @@ class OneupUploaderExtension extends Extension return $storageService; } - protected function registerGaufretteStorage($key, $class, $filesystem, $buffer, $streamWrapper = null, $prefix = '') + protected function registerFilesystem($type, $key, $class, $filesystem, $buffer, $streamWrapper = null, $prefix = '') { - if(!class_exists('Gaufrette\\Filesystem')) - throw new InvalidArgumentException('You have to install Gaufrette in order to use it as a chunk storage service.'); + switch ($type) { + case 'gaufrette': + if (!class_exists('Gaufrette\\Filesystem')) { + throw new InvalidArgumentException('You have to install knplabs/knp-gaufrette-bundle in order to use it as a chunk storage service.'); + } + break; + case 'flysystem': + if (!class_exists('League\\Flysystem\\Filesystem')) { + throw new InvalidArgumentException('You have to install oneup/flysystem-bundle in order to use it as a chunk storage service.'); + } + break; + } - if(strlen($filesystem) <= 0) + if (strlen($filesystem) <= 0) throw new ServiceNotFoundException('Empty service name'); $streamWrapper = $this->normalizeStreamWrapper($streamWrapper); @@ -242,8 +274,7 @@ class OneupUploaderExtension extends Extension ->addArgument(new Reference($filesystem)) ->addArgument($this->getValueInBytes($buffer)) ->addArgument($streamWrapper) - ->addArgument($prefix) - ; + ->addArgument($prefix); } protected function getMaxUploadSize($input) diff --git a/Tests/Uploader/Storage/FlysystemOrphanageStorageTest.php b/Tests/Uploader/Storage/FlysystemOrphanageStorageTest.php new file mode 100644 index 0000000..a277d7e --- /dev/null +++ b/Tests/Uploader/Storage/FlysystemOrphanageStorageTest.php @@ -0,0 +1,119 @@ +<?php + +namespace Oneup\UploaderBundle\Tests\Uploader\Storage; + +use League\Flysystem\File; +use Oneup\UploaderBundle\Uploader\Chunk\Storage\FlysystemStorage as ChunkStorage; +use Oneup\UploaderBundle\Uploader\File\FlysystemFile; +use Oneup\UploaderBundle\Uploader\Storage\FlysystemOrphanageStorage; +use Symfony\Component\Filesystem\Filesystem; +use Symfony\Component\Finder\Finder; +use Symfony\Component\HttpFoundation\Session\Session; +use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; + +use League\Flysystem\Adapter\Local as Adapter; +use League\Flysystem\Filesystem as FSAdapter; +use Oneup\UploaderBundle\Uploader\Storage\FlysystemStorage as Storage; + +class FlysystemOrphanageStorageTest extends OrphanageTest +{ + protected $chunkDirectory; + protected $chunksKey = 'chunks'; + protected $orphanageKey = 'orphanage'; + + public function setUp() + { + $this->numberOfPayloads = 5; + $this->realDirectory = sys_get_temp_dir() . '/storage'; + $this->chunkDirectory = $this->realDirectory .'/' . $this->chunksKey; + $this->tempDirectory = $this->realDirectory . '/' . $this->orphanageKey; + $this->payloads = array(); + + if (!$this->checkIfTempnameMatchesAfterCreation()) { + $this->markTestSkipped('Temporary directories do not match'); + } + + $filesystem = new Filesystem(); + $filesystem->mkdir($this->realDirectory); + $filesystem->mkdir($this->chunkDirectory); + $filesystem->mkdir($this->tempDirectory); + + $adapter = new Adapter($this->realDirectory, true); + $filesystem = new FSAdapter($adapter); + + $this->storage = new Storage($filesystem, 100000); + + $chunkStorage = new ChunkStorage($filesystem, 100000, null, 'chunks'); + + // create orphanage + $session = new Session(new MockArraySessionStorage()); + $session->start(); + + $config = array('directory' => 'orphanage'); + + $this->orphanage = new FlysystemOrphanageStorage($this->storage, $session, $chunkStorage, $config, 'cat'); + + for ($i = 0; $i < $this->numberOfPayloads; $i ++) { + // create temporary file as if it was reassembled by the chunk manager + $file = tempnam($this->chunkDirectory, 'uploader'); + + $pointer = fopen($file, 'w+'); + fwrite($pointer, str_repeat('A', 1024), 1024); + fclose($pointer); + + //gaufrette needs the key relative to it's root + $fileKey = str_replace($this->realDirectory, '', $file); + + $this->payloads[] = new FlysystemFile(new File($filesystem, $fileKey), $filesystem); + } + } + + public function testUpload() + { + for ($i = 0; $i < $this->numberOfPayloads; $i ++) { + $this->orphanage->upload($this->payloads[$i], $i . 'notsogrumpyanymore.jpeg'); + } + + $finder = new Finder(); + $finder->in($this->tempDirectory)->files(); + $this->assertCount($this->numberOfPayloads, $finder); + + $finder = new Finder(); + // exclude the orphanage and the chunks + $finder->in($this->realDirectory)->exclude(array($this->orphanageKey, $this->chunksKey))->files(); + $this->assertCount(0, $finder); + } + + public function testUploadAndFetching() + { + for ($i = 0; $i < $this->numberOfPayloads; $i ++) { + $this->orphanage->upload($this->payloads[$i], $i . 'notsogrumpyanymore.jpeg'); + } + + $finder = new Finder(); + $finder->in($this->tempDirectory)->files(); + $this->assertCount($this->numberOfPayloads, $finder); + + $finder = new Finder(); + $finder->in($this->realDirectory)->exclude(array($this->orphanageKey, $this->chunksKey))->files(); + $this->assertCount(0, $finder); + + $files = $this->orphanage->uploadFiles(); + + $this->assertTrue(is_array($files)); + $this->assertCount($this->numberOfPayloads, $files); + + $finder = new Finder(); + $finder->in($this->tempDirectory)->files(); + $this->assertCount(0, $finder); + + $finder = new Finder(); + $finder->in($this->realDirectory)->files(); + $this->assertCount($this->numberOfPayloads, $finder); + } + + public function checkIfTempnameMatchesAfterCreation() + { + return strpos(tempnam($this->chunkDirectory, 'uploader'), $this->chunkDirectory) === 0; + } +} diff --git a/Tests/Uploader/Storage/FlysystemStorageTest.php b/Tests/Uploader/Storage/FlysystemStorageTest.php new file mode 100644 index 0000000..bdd43e9 --- /dev/null +++ b/Tests/Uploader/Storage/FlysystemStorageTest.php @@ -0,0 +1,61 @@ +<?php + +namespace Oneup\UploaderBundle\Tests\Uploader\Storage; + +use League\Flysystem\Adapter\Local as Adapter; +use League\Flysystem\Filesystem as FSAdapter; +use Oneup\UploaderBundle\Uploader\File\FilesystemFile; +use Oneup\UploaderBundle\Uploader\Storage\FlysystemStorage as Storage; +use Symfony\Component\Finder\Finder; +use Symfony\Component\Filesystem\Filesystem; +use Symfony\Component\HttpFoundation\File\UploadedFile; + +class FlysystemStorageTest extends \PHPUnit_Framework_TestCase +{ + protected $directory; + + /** + * @var Storage + */ + protected $storage; + protected $file; + + public function setUp() + { + $this->directory = sys_get_temp_dir() . '/storage'; + + // create temporary file + $this->file = tempnam(sys_get_temp_dir(), 'uploader'); + + $pointer = fopen($this->file, 'w+'); + fwrite($pointer, str_repeat('A', 1024), 1024); + fclose($pointer); + + $adapter = new Adapter($this->directory, true); + $filesystem = new FSAdapter($adapter); + + $this->storage = new Storage($filesystem, 100000); + } + + public function testUpload() + { + $payload = new FilesystemFile(new UploadedFile($this->file, 'grumpycat.jpeg', null, null, null, true)); + $this->storage->upload($payload, 'notsogrumpyanymore.jpeg'); + + $finder = new Finder(); + $finder->in($this->directory)->files(); + + $this->assertCount(1, $finder); + + foreach ($finder as $file) { + $this->assertEquals($file->getFilename(), 'notsogrumpyanymore.jpeg'); + $this->assertEquals($file->getSize(), 1024); + } + } + + public function tearDown() + { + $filesystem = new Filesystem(); + $filesystem->remove($this->directory); + } +} diff --git a/Tests/Uploader/Storage/OrphanageTest.php b/Tests/Uploader/Storage/OrphanageTest.php index 836ab86..ce3f6cd 100644 --- a/Tests/Uploader/Storage/OrphanageTest.php +++ b/Tests/Uploader/Storage/OrphanageTest.php @@ -2,6 +2,7 @@ namespace Oneup\UploaderBundle\Tests\Uploader\Storage; +use Oneup\UploaderBundle\Uploader\Storage\FlysystemOrphanageStorage; use Symfony\Component\Finder\Finder; use Symfony\Component\Filesystem\Filesystem; @@ -9,6 +10,10 @@ abstract class OrphanageTest extends \PHPUnit_Framework_Testcase { protected $tempDirectory; protected $realDirectory; + + /** + * @var \Oneup\UploaderBundle\Uploader\Storage\OrphanageStorageInterface + */ protected $orphanage; protected $storage; protected $payloads; diff --git a/Uploader/Chunk/Storage/FlysystemStorage.php b/Uploader/Chunk/Storage/FlysystemStorage.php new file mode 100644 index 0000000..19e7a44 --- /dev/null +++ b/Uploader/Chunk/Storage/FlysystemStorage.php @@ -0,0 +1,152 @@ +<?php +namespace Oneup\UploaderBundle\Uploader\Chunk\Storage; + +use Oneup\UploaderBundle\Uploader\File\FlysystemFile; +use League\Flysystem\Filesystem; +use Symfony\Component\HttpFoundation\File\UploadedFile; + +class FlysystemStorage implements ChunkStorageInterface +{ + + protected $unhandledChunk; + protected $prefix; + protected $streamWrapperPrefix; + + /** + * @var Filesystem + */ + private $filesystem; + + public $bufferSize; + + public function __construct(Filesystem $filesystem, $bufferSize, $streamWrapperPrefix, $prefix) + { + if ( + ! method_exists($filesystem, 'readStream') + || + ! method_exists($filesystem, 'putStream') + ) { + throw new \InvalidArgumentException('The filesystem used as chunk storage must streamable'); + } + + $this->filesystem = $filesystem; + $this->bufferSize = $bufferSize; + $this->prefix = $prefix; + $this->streamWrapperPrefix = $streamWrapperPrefix; + } + + public function clear($maxAge, $prefix = null) + { + $prefix = $prefix ? :$this->prefix; + $matches = $this->filesystem->listFiles($prefix); + + $now = time(); + $toDelete = array(); + + // Collect the directories that are old, + // this also means the files inside are old + // but after the files are deleted the dirs + // would remain + foreach ($matches['dirs'] as $key) { + if ($maxAge <= $now-$this->filesystem->getTimestamp($key)) { + $toDelete[] = $key; + } + } + // The same directory is returned for every file it contains + array_unique($toDelete); + foreach ($matches['keys'] as $key) { + if ($maxAge <= $now-$this->filesystem->getTimestamp($key)) { + $this->filesystem->delete($key); + } + } + + foreach ($toDelete as $key) { + // The filesystem will throw exceptions if + // a directory is not empty + try { + $this->filesystem->delete($key); + } catch (\Exception $e) { + continue; + } + } + } + + public function addChunk($uuid, $index, UploadedFile $chunk, $original) + { + $this->unhandledChunk = array( + 'uuid' => $uuid, + 'index' => $index, + 'chunk' => $chunk, + 'original' => $original + ); + } + + public function assembleChunks($chunks, $removeChunk, $renameChunk) + { + // the index is only added to be in sync with the filesystem storage + $path = $this->prefix.'/'.$this->unhandledChunk['uuid'].'/'; + $filename = $this->unhandledChunk['index'].'_'.$this->unhandledChunk['original']; + + if (empty($chunks)) { + $target = $filename; + } else { + sort($chunks, SORT_STRING | SORT_FLAG_CASE); + $target = pathinfo($chunks[0], PATHINFO_BASENAME); + } + + + if ($this->unhandledChunk['index'] === 0) { + // if it's the first chunk overwrite the already existing part + // to avoid appending to earlier failed uploads + $handle = fopen($path . '/' . $target, 'w'); + } else { + $handle = fopen($path . '/' . $target, 'a'); + } + + $this->filesystem->putStream($path . $target, $handle); + if ($renameChunk) { + $name = preg_replace('/^(\d+)_/', '', $target); + /* The name can only match if the same user in the same session is + * trying to upload a file under the same name AND the previous upload failed, + * somewhere between this function, and the cleanup call. If that happened + * the previous file is unaccessible by the user, but if it is not removed + * it will block the user from trying to re-upload it. + */ + if ($this->filesystem->has($path.$name)) { + $this->filesystem->delete($path.$name); + } + + $this->filesystem->rename($path.$target, $path.$name); + $target = $name; + } + $uploaded = $this->filesystem->get($path.$target); + + if (!$renameChunk) { + return $uploaded; + } + + return new FlysystemFile($uploaded, $this->filesystem, $this->streamWrapperPrefix); + } + + public function cleanup($path) + { + $this->filesystem->delete($path); + } + + public function getChunks($uuid) + { + $results = $this->filesystem->listFiles($this->prefix.'/'.$uuid); + return preg_grep('/^.+\/(\d+)_/', $results['keys']); + } + + public function getFilesystem() + { + return $this->filesystem; + } + + public function getStreamWrapperPrefix() + { + return $this->streamWrapperPrefix; + } + +} diff --git a/Uploader/File/FlysystemFile.php b/Uploader/File/FlysystemFile.php new file mode 100644 index 0000000..dc36e69 --- /dev/null +++ b/Uploader/File/FlysystemFile.php @@ -0,0 +1,48 @@ +<?php +namespace Oneup\UploaderBundle\Uploader\File; + +use League\Flysystem\File; +use League\Flysystem\Filesystem; + +class FlysystemFile extends File implements FileInterface +{ + + protected $streamWrapperPrefix; + protected $mimeType; + + public function __construct(File $file, Filesystem $filesystem, $streamWrapperPrefix = null) + { + parent::__construct($filesystem, $file->getPath()); + $this->streamWrapperPrefix = $streamWrapperPrefix; + } + + /** + * Returns the path of the file + * + * @return string + */ + public function getPathname() + { + return $this->getPath(); + } + + /** + * Returns the basename of the file + * + * @return string + */ + public function getBasename() + { + return pathinfo($this->getPath(), PATHINFO_BASENAME); + } + + /** + * Returns the guessed extension of the file + * + * @return mixed + */ + public function getExtension() + { + return pathinfo($this->getPath(), PATHINFO_EXTENSION); + } +} diff --git a/Uploader/Gaufrette/StreamManager.php b/Uploader/Gaufrette/StreamManager.php index 58868b8..7fcc83a 100644 --- a/Uploader/Gaufrette/StreamManager.php +++ b/Uploader/Gaufrette/StreamManager.php @@ -25,11 +25,9 @@ class StreamManager protected function ensureRemotePathExists($path) { - // this is a somehow ugly workaround introduced - // because the stream-mode is not able to create - // subdirectories. - if(!$this->filesystem->has($path)) + if(!$this->filesystem->has($path)) { $this->filesystem->write($path, '', true); + } } protected function openStream(Stream $stream, $mode) diff --git a/Uploader/Storage/FlysystemOrphanageStorage.php b/Uploader/Storage/FlysystemOrphanageStorage.php new file mode 100644 index 0000000..d9947c3 --- /dev/null +++ b/Uploader/Storage/FlysystemOrphanageStorage.php @@ -0,0 +1,93 @@ +<?php + +namespace Oneup\UploaderBundle\Uploader\Storage; + +use League\Flysystem\File; +use Oneup\UploaderBundle\Uploader\Chunk\Storage\FlysystemStorage as ChunkStorage; +use Oneup\UploaderBundle\Uploader\File\FileInterface; +use Oneup\UploaderBundle\Uploader\File\FlysystemFile; +use Symfony\Component\HttpFoundation\Session\SessionInterface; + +class FlysystemOrphanageStorage extends FlysystemStorage implements OrphanageStorageInterface +{ + protected $storage; + protected $session; + protected $chunkStorage; + protected $config; + protected $type; + + /** + * @param StorageInterface $storage + * @param SessionInterface $session + * @param ChunkStorage $chunkStorage This class is only used if the gaufrette chunk storage is used. + * @param $config + * @param $type + */ + public function __construct(StorageInterface $storage, SessionInterface $session, ChunkStorage $chunkStorage, $config, $type) + { + /* + * initiate the storage on the chunk storage's filesystem + * the stream wrapper is useful for metadata. + */ + parent::__construct($chunkStorage->getFilesystem(), $chunkStorage->bufferSize, $chunkStorage->getStreamWrapperPrefix()); + + $this->storage = $storage; + $this->chunkStorage = $chunkStorage; + $this->session = $session; + $this->config = $config; + $this->type = $type; + } + + public function upload(FileInterface $file, $name, $path = null) + { + if(!$this->session->isStarted()) + throw new \RuntimeException('You need a running session in order to run the Orphanage.'); + + return parent::upload($file, $name, $this->getPath()); + } + + public function uploadFiles(array $files = null) + { + try { + if (null === $files) { + $files = $this->getFiles(); + } + $return = array(); + + foreach ($files as $key => $file) { + try { + $return[] = $this->storage->upload($file, str_replace($this->getPath(), '', $key)); + } catch (\Exception $e) { + // well, we tried. + continue; + } + } + + return $return; + } catch (\Exception $e) { + return array(); + } + } + + public function getFiles() + { + $keys = $this->chunkStorage->getFilesystem()->listFiles($this->getPath()); + $keys = $keys['keys']; + $files = array(); + + foreach ($keys as $key) { + // gotta pass the filesystem to both as you can't get it out from one.. + $files[$key] = new FlysystemFile(new File($this->chunkStorage->getFilesystem(), $key), $this->chunkStorage->getFilesystem()); + } + + return $files; + } + + protected function getPath() + { + // the storage is initiated in the root of the filesystem, from where the orphanage directory + // should be relative. + return sprintf('%s/%s/%s', $this->config['directory'], $this->session->getId(), $this->type); + } + +} diff --git a/Uploader/Storage/FlysystemStorage.php b/Uploader/Storage/FlysystemStorage.php new file mode 100644 index 0000000..4d0212d --- /dev/null +++ b/Uploader/Storage/FlysystemStorage.php @@ -0,0 +1,59 @@ +<?php + +namespace Oneup\UploaderBundle\Uploader\Storage; + +use League\Flysystem\Filesystem; +use Oneup\UploaderBundle\Uploader\File\FileInterface; +use Oneup\UploaderBundle\Uploader\File\FlysystemFile; +use Symfony\Component\Filesystem\Filesystem as LocalFilesystem; + +class FlysystemStorage implements StorageInterface +{ + + /** + * @var null|string + */ + protected $streamWrapperPrefix; + + /** + * @var float + */ + protected $bufferSize; + + /** + * @var Filesystem + */ + private $filesystem; + + public function __construct(Filesystem $filesystem, $bufferSize, $streamWrapperPrefix = null) + { + $this->filesystem = $filesystem; + $this->bufferSize = $bufferSize; + $this->streamWrapperPrefix = $streamWrapperPrefix; + } + + public function upload(FileInterface $file, $name, $path = null) + { + $path = is_null($path) ? $name : sprintf('%s/%s', $path, $name); + + if ($file instanceof FlysystemFile) { + if ($file->getFilesystem() == $this->filesystem) { + $file->getFilesystem()->rename($file->getPath(), $path); + + return new FlysystemFile($this->filesystem->get($path), $this->filesystem, $this->streamWrapperPrefix); + } + } + + $this->filesystem->put($name, file_get_contents($file)); + + if ($file instanceof FlysystemFile) { + $file->delete(); + } else { + $filesystem = new LocalFilesystem(); + $filesystem->remove($file->getPathname()); + } + + return new FlysystemFile($this->filesystem->get($path), $this->filesystem, $this->streamWrapperPrefix); + } + +} diff --git a/composer.json b/composer.json index b2f32a3..69253bb 100644 --- a/composer.json +++ b/composer.json @@ -26,11 +26,13 @@ "symfony/security-bundle": "2.*|~3.0", "sensio/framework-extra-bundle": "2.*|~3.0", "symfony/browser-kit": "2.*|~3.0", - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "~4.4", + "oneup/flysystem-bundle": "^1.2" }, "suggest": { - "knplabs/knp-gaufrette-bundle": "0.1.*" + "knplabs/knp-gaufrette-bundle": "0.1.*", + "oneup/flysystem-bundle": "^1.2" }, "autoload": {
0
4b9eac4d9a49dc5a14d4fd739d8f914af84ee4a6
1up-lab
OneupUploaderBundle
Enables and fixes some skipped Flysystem tests This also updates the FlysystemOrphanStorage component to avoid reliance on the Flysystem filesystem's listFiles method which has been moved out of the core and into a plugin in current releases of Flysystem.
commit 4b9eac4d9a49dc5a14d4fd739d8f914af84ee4a6 Author: snarktooth <[email protected]> Date: Thu May 26 09:42:33 2016 -0500 Enables and fixes some skipped Flysystem tests This also updates the FlysystemOrphanStorage component to avoid reliance on the Flysystem filesystem's listFiles method which has been moved out of the core and into a plugin in current releases of Flysystem. diff --git a/Tests/Uploader/Storage/FlysystemOrphanageStorageTest.php b/Tests/Uploader/Storage/FlysystemOrphanageStorageTest.php index a277d7e..102e954 100644 --- a/Tests/Uploader/Storage/FlysystemOrphanageStorageTest.php +++ b/Tests/Uploader/Storage/FlysystemOrphanageStorageTest.php @@ -29,15 +29,15 @@ class FlysystemOrphanageStorageTest extends OrphanageTest $this->tempDirectory = $this->realDirectory . '/' . $this->orphanageKey; $this->payloads = array(); - if (!$this->checkIfTempnameMatchesAfterCreation()) { - $this->markTestSkipped('Temporary directories do not match'); - } - $filesystem = new Filesystem(); $filesystem->mkdir($this->realDirectory); $filesystem->mkdir($this->chunkDirectory); $filesystem->mkdir($this->tempDirectory); + if (!$this->checkIfTempnameMatchesAfterCreation()) { + $this->markTestSkipped('Temporary directories do not match'); + } + $adapter = new Adapter($this->realDirectory, true); $filesystem = new FSAdapter($adapter); @@ -61,7 +61,7 @@ class FlysystemOrphanageStorageTest extends OrphanageTest fwrite($pointer, str_repeat('A', 1024), 1024); fclose($pointer); - //gaufrette needs the key relative to it's root + //file key needs to be relative to the root of the flysystem filesystem $fileKey = str_replace($this->realDirectory, '', $file); $this->payloads[] = new FlysystemFile(new File($filesystem, $fileKey), $filesystem); @@ -95,7 +95,9 @@ class FlysystemOrphanageStorageTest extends OrphanageTest $this->assertCount($this->numberOfPayloads, $finder); $finder = new Finder(); - $finder->in($this->realDirectory)->exclude(array($this->orphanageKey, $this->chunksKey))->files(); + $finder->in($this->realDirectory) + ->exclude(array($this->orphanageKey, $this->chunksKey)) + ->files(); $this->assertCount(0, $finder); $files = $this->orphanage->uploadFiles(); @@ -114,6 +116,10 @@ class FlysystemOrphanageStorageTest extends OrphanageTest public function checkIfTempnameMatchesAfterCreation() { - return strpos(tempnam($this->chunkDirectory, 'uploader'), $this->chunkDirectory) === 0; + $testName = tempnam($this->chunkDirectory, 'uploader'); + $result = strpos($testName, $this->chunkDirectory) === 0; + unlink($testName); + + return $result; } } diff --git a/Uploader/Storage/FlysystemOrphanageStorage.php b/Uploader/Storage/FlysystemOrphanageStorage.php index d9947c3..376deb5 100644 --- a/Uploader/Storage/FlysystemOrphanageStorage.php +++ b/Uploader/Storage/FlysystemOrphanageStorage.php @@ -71,13 +71,19 @@ class FlysystemOrphanageStorage extends FlysystemStorage implements OrphanageSto public function getFiles() { - $keys = $this->chunkStorage->getFilesystem()->listFiles($this->getPath()); - $keys = $keys['keys']; + $fileList = $this->chunkStorage + ->getFilesystem() + ->listContents($this->getPath()); $files = array(); - foreach ($keys as $key) { - // gotta pass the filesystem to both as you can't get it out from one.. - $files[$key] = new FlysystemFile(new File($this->chunkStorage->getFilesystem(), $key), $this->chunkStorage->getFilesystem()); + foreach ($fileList as $fileDetail) { + $key = $fileDetail['path']; + if ($fileDetail['type'] == 'file') { + $files[$key] = new FlysystemFile( + new File($this->chunkStorage->getFilesystem(), $key), + $this->chunkStorage->getFilesystem() + ); + } } return $files;
0
6a7158e0174adac36daae74e9fca822cc7b52d4c
1up-lab
OneupUploaderBundle
Added test setup including a dummy test for travis tests.
commit 6a7158e0174adac36daae74e9fca822cc7b52d4c Author: Jim Schmid <[email protected]> Date: Fri Mar 8 18:53:49 2013 +0100 Added test setup including a dummy test for travis tests. diff --git a/.gitignore b/.gitignore index 19982ea..e1c36a4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ composer.lock +phpunit.xml vendor \ No newline at end of file diff --git a/Tests/DependencyInjection/OneupUploaderExtensionTest.php b/Tests/DependencyInjection/OneupUploaderExtensionTest.php new file mode 100644 index 0000000..b713e61 --- /dev/null +++ b/Tests/DependencyInjection/OneupUploaderExtensionTest.php @@ -0,0 +1,11 @@ +<?php + +namespace Oneup\UploaderBundle\Tests\DependencyInjection; + +class OneupUploaderExtensionTest extends \PHPUnit_Framework_TestCase +{ + public function testDummyForSetup() + { + $this->assertTrue(true); + } +} \ No newline at end of file diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 0000000..b34158b --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<phpunit colors="true"> + + <testsuites> + <testsuite name="OneupUploaderBundle test suite"> + <directory suffix="Test.php">./Tests</directory> + </testsuite> + </testsuites> + + <filter> + <whitelist> + <directory>./</directory> + <exclude> + <directory>./Resources</directory> + <directory>./Tests</directory> + </exclude> + </whitelist> + </filter> +</phpunit> \ No newline at end of file
0
8389a0a5d0b06c084ebbad7b35f9afc10d122a7b
1up-lab
OneupUploaderBundle
Merge pull request #266 from mablae/patch-1 Add flysystem to Readme
commit 8389a0a5d0b06c084ebbad7b35f9afc10d122a7b Merge: 7920b43 2e926bd Author: David Greminger <[email protected]> Date: Tue Oct 4 15:26:27 2016 +0200 Merge pull request #266 from mablae/patch-1 Add flysystem to Readme
0
5b1b2076daab43b3e8aaed9e0b43cb537142c456
1up-lab
OneupUploaderBundle
Merge branch 'snarktooth-master'
commit 5b1b2076daab43b3e8aaed9e0b43cb537142c456 Merge: c5a1ce9 aec4bea Author: David Greminger <[email protected]> Date: Wed May 3 11:01:35 2017 +0200 Merge branch 'snarktooth-master'
0
59659bda1dbd944cf18d140417ff5f29c8622644
1up-lab
OneupUploaderBundle
Removed a paragraph which pointed out that this bundle only supports FineUploader.
commit 59659bda1dbd944cf18d140417ff5f29c8622644 Author: Jim Schmid <[email protected]> Date: Fri Apr 12 15:11:11 2013 +0200 Removed a paragraph which pointed out that this bundle only supports FineUploader. diff --git a/Resources/doc/index.md b/Resources/doc/index.md index 0aae9be..9b6afe0 100644 --- a/Resources/doc/index.md +++ b/Resources/doc/index.md @@ -99,8 +99,6 @@ So if you take the mapping described before, the generated route name would be ` * [Use FancyUpload](frontend_fancyupload.md) * [Use MooUpload](frontend_mooupload.md) -This is of course a very minimal setup. Be sure to include stylesheets for Fine Uploader if you want to use them. - ## Next steps After installing and setting up the basic functionality of this bundle you can move on and integrate
0
b330a5dc11d307f8820a7b740b8460f5346d9187
1up-lab
OneupUploaderBundle
Merge branch 'dropzone-eventhandler' of https://github.com/perk11/OneupUploaderBundle into perk11-dropzone-eventhandler
commit b330a5dc11d307f8820a7b740b8460f5346d9187 Merge: 568dfb1 f420fff Author: David Greminger <[email protected]> Date: Thu Dec 10 10:42:55 2015 +0100 Merge branch 'dropzone-eventhandler' of https://github.com/perk11/OneupUploaderBundle into perk11-dropzone-eventhandler diff --cc Controller/DropzoneController.php index 2121f32,f8cf580..fd11420 --- a/Controller/DropzoneController.php +++ b/Controller/DropzoneController.php @@@ -19,12 -19,8 +19,13 @@@ class DropzoneController extends Abstra try { $this->handleUpload($file, $response, $request); } catch (UploadException $e) { + $statusCode = 500; //Dropzone displays error if HTTP response is 40x or 50x $this->errorHandler->addException($response, $e); + $translator = $this->container->get('translator'); + $message = $translator->trans($e->getMessage(), array(), 'OneupUploaderBundle'); + $response = $this->createSupportedJsonResponse(array('error'=>$message )); + $response->setStatusCode(400); + return $response; } }
0
d30b3a48547daac095759a2cb5f4acb832e5e568
1up-lab
OneupUploaderBundle
Merge pull request #181 from 1up-lab/sheeep-patch-1 Changed $file to $chunk.
commit d30b3a48547daac095759a2cb5f4acb832e5e568 Merge: 1fe30e7 2453924 Author: Jim Schmid <[email protected]> Date: Mon Jun 15 17:41:49 2015 +0200 Merge pull request #181 from 1up-lab/sheeep-patch-1 Changed $file to $chunk.
0
8c19eef2c76baeff52bc5812bad0ab3e53ab4d79
1up-lab
OneupUploaderBundle
Require symfony/mime directly (#380)
commit 8c19eef2c76baeff52bc5812bad0ab3e53ab4d79 Author: David Greminger <[email protected]> Date: Mon Jun 29 17:41:57 2020 +0200 Require symfony/mime directly (#380) diff --git a/composer.json b/composer.json index 278b963..ef7faad 100644 --- a/composer.json +++ b/composer.json @@ -26,6 +26,7 @@ "symfony/event-dispatcher-contracts": "^1.0|^2.0", "symfony/finder": "^4.4|^5.0", "symfony/framework-bundle": "^4.4|^5.0", + "symfony/mime": "^4.4|^5.0", "symfony/templating": "^4.4|^5.0", "symfony/translation": "^4.4|^5.0", "symfony/translation-contracts": "^1.0|^2.0",
0
42e611f3c377f99f1cf32d859e26dad4cf2c3ab1
1up-lab
OneupUploaderBundle
Remove unneeded check in constructor
commit 42e611f3c377f99f1cf32d859e26dad4cf2c3ab1 Author: Jérôme Parmentier <[email protected]> Date: Fri Oct 6 17:59:07 2017 +0200 Remove unneeded check in constructor diff --git a/Uploader/Chunk/Storage/FlysystemStorage.php b/Uploader/Chunk/Storage/FlysystemStorage.php index 5afbfa5..77eabc6 100644 --- a/Uploader/Chunk/Storage/FlysystemStorage.php +++ b/Uploader/Chunk/Storage/FlysystemStorage.php @@ -22,14 +22,6 @@ class FlysystemStorage implements ChunkStorageInterface public function __construct(Filesystem $filesystem, $bufferSize, $streamWrapperPrefix, $prefix) { - if ( - !method_exists($filesystem, 'readStream') - || - !method_exists($filesystem, 'putStream') - ) { - throw new \InvalidArgumentException('The filesystem used as chunk storage must streamable'); - } - if (null === $streamWrapperPrefix) { throw new \InvalidArgumentException('Stream wrapper must be configured.'); }
0
8aaf201af2e6be88a91d293170b96a5106ce87e2
1up-lab
OneupUploaderBundle
Changed handlechuckedupload to use the getrequest
commit 8aaf201af2e6be88a91d293170b96a5106ce87e2 Author: Martin Aarhof <[email protected]> Date: Wed Dec 9 10:29:54 2015 +0100 Changed handlechuckedupload to use the getrequest diff --git a/Controller/AbstractChunkedController.php b/Controller/AbstractChunkedController.php index 4cd14c2..4cf0f13 100644 --- a/Controller/AbstractChunkedController.php +++ b/Controller/AbstractChunkedController.php @@ -45,7 +45,7 @@ abstract class AbstractChunkedController extends AbstractController protected function handleChunkedUpload(UploadedFile $file, ResponseInterface $response, Request $request) { // get basic container stuff - $request = $this->container->get('request_stack')->getMasterRequest(); + $request = $this->getRequest(); $chunkManager = $this->container->get('oneup_uploader.chunk_manager'); // get information about this chunked request
0
efdaa42ba08f672ceb101a6bdf8e8fef61904a01
1up-lab
OneupUploaderBundle
Added Orphanage-Storage.
commit efdaa42ba08f672ceb101a6bdf8e8fef61904a01 Author: Jim Schmid <[email protected]> Date: Wed Mar 27 19:04:21 2013 +0100 Added Orphanage-Storage. diff --git a/Uploader/Storage/OrphanageStorage.php b/Uploader/Storage/OrphanageStorage.php new file mode 100644 index 0000000..a463039 --- /dev/null +++ b/Uploader/Storage/OrphanageStorage.php @@ -0,0 +1,78 @@ +<?php + +namespace Oneup\UploaderBundle\Storage; + +use Symfony\Component\Finder\Finder; +use Symfony\Component\Filesystem\Filesystem; +use Gaufrette\Filesystem; + +use Oneup\UploaderBundle\Storage\GaufretteStorage; + +class OrphanageStorage extends GaufretteStorage implements OrphanageStorageInterface +{ + protected $masked; + protected $session; + protected $config; + protected $type; + + public function __construct(Gaufrette $orphanage, Gaufrette $filesystem, SessionInterface $session, $config, $type) + { + parent::__construct($orphanage); + + $this->masked = $filesystem; + $this->session = $session; + $this->config = $config; + $this->type = $type; + } + + public function upload(File $file, $name = null) + { + if(!$this->session->isStarted()) + throw new \RuntimeException('You need a running session in order to run the Orphanage.'); + + parent::upload($file, $name); + } + + public function uploadFiles($keep = false) + { + $system = new Filesystem(); + $finder = new Finder(); + + // switch orphanage with masked filesystem + $this->filesystem = $this->masked; + + if(!$system->exists($this->getPath())) + return array(); + + $finder->in($this->getPathRelativeToSession())->files(); + + $uploaded = array(); + foreach($finder as $file) + { + $uploaded[] = $this->upload(new UploadedFile($file->getPathname(), $file->getBasename(), null, null, null, true)); + + if(!$keep) + { + $system->remove($file); + } + } + + return $uploaded; + } + + protected function getPath() + { + $id = $this->session->getId(); + $path = sprintf('%s/%s/%s', $this->config['directory'], $id, $this->type); + + return $path; + } + + protected function getPathRelativeToSession() + { + $id = $this->session->getId(); + $path = sprintf('%s/%s', $this->config['directory'], $id); + + return $path; + } +} \ No newline at end of file diff --git a/Uploader/Storage/OrphanageStorageInterface.php b/Uploader/Storage/OrphanageStorageInterface.php new file mode 100644 index 0000000..de0eb47 --- /dev/null +++ b/Uploader/Storage/OrphanageStorageInterface.php @@ -0,0 +1,11 @@ +<?php + +namespace Oneup\UploaderBundle\Uploader\Storage; + +use Symfony\Component\HttpFoundation\File\File; +use Oneup\UploaderBundle\Uploader\Storage\StorageInterface; + +interface OrphanageStorageInterface extends StorageInterface +{ + public function uploadFiles($keep = false); +}
0
fa06d1f733a9dde68bbb52a42bdb69b9a4e44bf9
1up-lab
OneupUploaderBundle
Merge branch 'lsv-really-uniquenamer'
commit fa06d1f733a9dde68bbb52a42bdb69b9a4e44bf9 Merge: a453078 46acc77 Author: David Greminger <[email protected]> Date: Fri Sep 15 16:35:08 2017 +0200 Merge branch 'lsv-really-uniquenamer'
0
461e503cef5d1f73b784aecf1131a79fcc8ed181
1up-lab
OneupUploaderBundle
Update readme according to Symfony 6 support
commit 461e503cef5d1f73b784aecf1131a79fcc8ed181 Author: David Greminger <[email protected]> Date: Mon Mar 21 14:30:30 2022 +0100 Update readme according to Symfony 6 support diff --git a/README.md b/README.md index 4b177c6..eaa78ab 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ The entry point of the documentation can be found in the file `docs/index.md` Upgrade Notes ------------- +* Version **3.2.0** supports now Symfony 6 (kudos to @[pich](https://github.com/pich)), see [#421](https://github.com/1up-lab/OneupUploaderBundle/pull/421)! PHP 7.2/7.3 support was dropped. * Version **3.0.0** supports now Symfony 5 (kudos to @[steveWinter](https://github.com/steveWinter), @[gubler](https://github.com/gubler), @[patrickbussmann](https://github.com/patrickbussmann), @[ErnadoO](https://github.com/ErnadoO) and @[enumag](https://github.com/enumag), see [#373](https://github.com/1up-lab/OneupUploaderBundle/pull/373)! Symfony 3.x support was dropped. * Version **2.0.0** supports now Symfony 4 (Thank you @[istvancsabakis](https://github.com/istvancsabakis), see [#295](https://github.com/1up-lab/OneupUploaderBundle/pull/295))! Symfony 2.x support was dropped. You can also configure a file extension validation whitelist now (PR [#262](https://github.com/1up-lab/OneupUploaderBundle/pull/262)). * Version **1.5.0** supports now [Flysystem](https://github.com/1up-lab/OneupFlysystemBundle) (Thank you @[lsv](https://github.com/lsv)! PR [#213](https://github.com/1up-lab/OneupUploaderBundle/pull/213)) and is no longer compatible with PHP 5.3 (it's [EOL](http://php.net/eol.php) since August 2014 anyway).
0
341c88053299b932efefbd1ae068b2cae9a267da
1up-lab
OneupUploaderBundle
Test against null to avoid object to boolean conversion.
commit 341c88053299b932efefbd1ae068b2cae9a267da Author: Jim Schmid <[email protected]> Date: Mon Oct 14 21:31:37 2013 +0200 Test against null to avoid object to boolean conversion. diff --git a/Controller/AbstractChunkedController.php b/Controller/AbstractChunkedController.php index 2e803bb..db4d784 100644 --- a/Controller/AbstractChunkedController.php +++ b/Controller/AbstractChunkedController.php @@ -60,7 +60,8 @@ abstract class AbstractChunkedController extends AbstractController if ($chunkManager->getLoadDistribution()) { $chunks = $chunkManager->getChunks($uuid); $assembled = $chunkManager->assembleChunks($chunks, true, $last); - if (!$chunk) { + + if (is_null($chunk)) { $this->dispatchChunkEvents($assembled, $response, $request, $last); } }
0
1fd249208fd44bb89ebd93a21d8a7e6f2f9af505
1up-lab
OneupUploaderBundle
Changed request to master request
commit 1fd249208fd44bb89ebd93a21d8a7e6f2f9af505 Author: Martin Aarhof <[email protected]> Date: Wed Dec 9 10:25:43 2015 +0100 Changed request to master request diff --git a/Controller/AbstractChunkedController.php b/Controller/AbstractChunkedController.php index 62f9df1..4cd14c2 100644 --- a/Controller/AbstractChunkedController.php +++ b/Controller/AbstractChunkedController.php @@ -45,7 +45,7 @@ abstract class AbstractChunkedController extends AbstractController protected function handleChunkedUpload(UploadedFile $file, ResponseInterface $response, Request $request) { // get basic container stuff - $request = $this->container->get('request'); + $request = $this->container->get('request_stack')->getMasterRequest(); $chunkManager = $this->container->get('oneup_uploader.chunk_manager'); // get information about this chunked request diff --git a/Controller/AbstractController.php b/Controller/AbstractController.php index a551ba8..7341727 100644 --- a/Controller/AbstractController.php +++ b/Controller/AbstractController.php @@ -38,7 +38,7 @@ abstract class AbstractController public function progress() { - $request = $this->container->get('request'); + $request = $this->getRequest(); $session = $this->container->get('session'); $prefix = ini_get('session.upload_progress.prefix'); @@ -54,7 +54,7 @@ abstract class AbstractController public function cancel() { - $request = $this->container->get('request'); + $request = $this->getRequest(); $session = $this->container->get('session'); $prefix = ini_get('session.upload_progress.prefix'); @@ -73,8 +73,8 @@ abstract class AbstractController /** * Flattens a given filebag to extract all files. * - * @param bag The filebag to use - * @return array An array of files + * @param FileBag $bag The filebag to use + * @return array An array of files */ protected function getFiles(FileBag $bag) { @@ -100,9 +100,9 @@ abstract class AbstractController * * Note: The return value differs when * - * @param The file to upload - * @param response A response object. - * @param request The request object. + * @param mixed $file The file to upload + * @param ResponseInterface $response A response object. + * @param Request $request The request object. */ protected function handleUpload($file, ResponseInterface $response, Request $request) { @@ -129,9 +129,9 @@ abstract class AbstractController /** * This function is a helper function which dispatches pre upload event * - * @param uploaded The uploaded file. - * @param response A response object. - * @param request The request object. + * @param FileInterface $uploaded The uploaded file. + * @param ResponseInterface $response A response object. + * @param Request $request The request object. */ protected function dispatchPreUploadEvent(FileInterface $uploaded, ResponseInterface $response, Request $request) { @@ -147,9 +147,9 @@ abstract class AbstractController * This function is a helper function which dispatches post upload * and post persist events. * - * @param uploaded The uploaded file. - * @param response A response object. - * @param request The request object. + * @param mixed $uploaded The uploaded file. + * @param ResponseInterface $response A response object. + * @param Request $request The request object. */ protected function dispatchPostEvents($uploaded, ResponseInterface $response, Request $request) { @@ -171,7 +171,7 @@ abstract class AbstractController protected function validate(FileInterface $file) { $dispatcher = $this->container->get('event_dispatcher'); - $event = new ValidationEvent($file, $this->container->get('request'), $this->config, $this->type); + $event = new ValidationEvent($file, $this->getRequest(), $this->config, $this->type); $dispatcher->dispatch(UploadEvents::VALIDATION, $event); } @@ -188,7 +188,7 @@ abstract class AbstractController */ protected function createSupportedJsonResponse($data) { - $request = $this->container->get('request'); + $request = $this->getRequest(); $response = new JsonResponse($data); $response->headers->set('Vary', 'Accept'); @@ -198,4 +198,15 @@ abstract class AbstractController return $response; } + + /** + * Get the master request + * + * @return Request + */ + protected function getRequest() + { + return $this->container->get('request_stack')->getMasterRequest(); + } + } diff --git a/Controller/BlueimpController.php b/Controller/BlueimpController.php index f9186c7..f12329e 100644 --- a/Controller/BlueimpController.php +++ b/Controller/BlueimpController.php @@ -5,14 +5,13 @@ namespace Oneup\UploaderBundle\Controller; use Symfony\Component\HttpFoundation\File\Exception\UploadException; use Symfony\Component\HttpFoundation\Request; -use Oneup\UploaderBundle\Controller\AbstractChunkedController; use Oneup\UploaderBundle\Uploader\Response\EmptyResponse; class BlueimpController extends AbstractChunkedController { public function upload() { - $request = $this->container->get('request'); + $request = $this->getRequest(); $response = new EmptyResponse(); $files = $this->getFiles($request->files); @@ -34,7 +33,7 @@ class BlueimpController extends AbstractChunkedController public function progress() { - $request = $this->container->get('request'); + $request = $this->getRequest(); $session = $this->container->get('session'); $prefix = ini_get('session.upload_progress.prefix'); diff --git a/Controller/DropzoneController.php b/Controller/DropzoneController.php index 2121f32..11b5339 100644 --- a/Controller/DropzoneController.php +++ b/Controller/DropzoneController.php @@ -4,14 +4,13 @@ namespace Oneup\UploaderBundle\Controller; use Symfony\Component\HttpFoundation\File\Exception\UploadException; -use Oneup\UploaderBundle\Controller\AbstractController; use Oneup\UploaderBundle\Uploader\Response\EmptyResponse; class DropzoneController extends AbstractController { public function upload() { - $request = $this->container->get('request'); + $request = $this->getRequest(); $response = new EmptyResponse(); $files = $this->getFiles($request->files); diff --git a/Controller/FancyUploadController.php b/Controller/FancyUploadController.php index bc21006..2aae793 100644 --- a/Controller/FancyUploadController.php +++ b/Controller/FancyUploadController.php @@ -4,14 +4,13 @@ namespace Oneup\UploaderBundle\Controller; use Symfony\Component\HttpFoundation\File\Exception\UploadException; -use Oneup\UploaderBundle\Controller\AbstractController; use Oneup\UploaderBundle\Uploader\Response\EmptyResponse; class FancyUploadController extends AbstractController { public function upload() { - $request = $this->container->get('request'); + $request = $this->getRequest(); $response = new EmptyResponse(); $files = $this->getFiles($request->files); diff --git a/Controller/FineUploaderController.php b/Controller/FineUploaderController.php index 246b7f6..79cab8c 100644 --- a/Controller/FineUploaderController.php +++ b/Controller/FineUploaderController.php @@ -5,14 +5,13 @@ namespace Oneup\UploaderBundle\Controller; use Symfony\Component\HttpFoundation\File\Exception\UploadException; use Symfony\Component\HttpFoundation\Request; -use Oneup\UploaderBundle\Controller\AbstractChunkedController; use Oneup\UploaderBundle\Uploader\Response\FineUploaderResponse; class FineUploaderController extends AbstractChunkedController { public function upload() { - $request = $this->container->get('request'); + $request = $this->getRequest(); $translator = $this->container->get('translator'); $response = new FineUploaderResponse(); diff --git a/Controller/MooUploadController.php b/Controller/MooUploadController.php index e4f055b..95babd4 100644 --- a/Controller/MooUploadController.php +++ b/Controller/MooUploadController.php @@ -6,7 +6,6 @@ use Symfony\Component\HttpFoundation\File\UploadedFile; use Symfony\Component\HttpFoundation\File\Exception\UploadException; use Symfony\Component\HttpFoundation\Request; -use Oneup\UploaderBundle\Controller\AbstractChunkedController; use Oneup\UploaderBundle\Uploader\Response\MooUploadResponse; class MooUploadController extends AbstractChunkedController @@ -15,7 +14,7 @@ class MooUploadController extends AbstractChunkedController public function upload() { - $request = $this->container->get('request'); + $request = $this->getRequest(); $response = new MooUploadResponse(); $headers = $request->headers; diff --git a/Controller/PluploadController.php b/Controller/PluploadController.php index 56cb151..ee0ceb4 100644 --- a/Controller/PluploadController.php +++ b/Controller/PluploadController.php @@ -5,14 +5,13 @@ namespace Oneup\UploaderBundle\Controller; use Symfony\Component\HttpFoundation\File\Exception\UploadException; use Symfony\Component\HttpFoundation\Request; -use Oneup\UploaderBundle\Controller\AbstractChunkedController; use Oneup\UploaderBundle\Uploader\Response\EmptyResponse; class PluploadController extends AbstractChunkedController { public function upload() { - $request = $this->container->get('request'); + $request = $this->getRequest(); $response = new EmptyResponse(); $files = $this->getFiles($request->files); diff --git a/Controller/UploadifyController.php b/Controller/UploadifyController.php index ea68396..b93c725 100644 --- a/Controller/UploadifyController.php +++ b/Controller/UploadifyController.php @@ -4,14 +4,13 @@ namespace Oneup\UploaderBundle\Controller; use Symfony\Component\HttpFoundation\File\Exception\UploadException; -use Oneup\UploaderBundle\Controller\AbstractController; use Oneup\UploaderBundle\Uploader\Response\EmptyResponse; class UploadifyController extends AbstractController { public function upload() { - $request = $this->container->get('request'); + $request = $this->getRequest(); $response = new EmptyResponse(); $files = $this->getFiles($request->files); diff --git a/Controller/YUI3Controller.php b/Controller/YUI3Controller.php index c79e72b..043cacc 100644 --- a/Controller/YUI3Controller.php +++ b/Controller/YUI3Controller.php @@ -4,14 +4,13 @@ namespace Oneup\UploaderBundle\Controller; use Symfony\Component\HttpFoundation\File\Exception\UploadException; -use Oneup\UploaderBundle\Controller\AbstractController; use Oneup\UploaderBundle\Uploader\Response\EmptyResponse; class YUI3Controller extends AbstractController { public function upload() { - $request = $this->container->get('request'); + $request = $this->getRequest(); $response = new EmptyResponse(); $files = $this->getFiles($request->files); diff --git a/Resources/doc/custom_uploader.md b/Resources/doc/custom_uploader.md index 20de413..c4fd761 100644 --- a/Resources/doc/custom_uploader.md +++ b/Resources/doc/custom_uploader.md @@ -40,7 +40,7 @@ class CustomUploader extends UploaderController public function upload() { // get some basic stuff together - $request = $this->container->get('request'); + $request = $this->container->get('request_stack')->getMasterRequest(); $response = new EmptyResponse(); // get file from request (your own logic) diff --git a/composer.json b/composer.json index aa66e5d..59fc218 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ ], "require": { - "symfony/framework-bundle": ">=2.2", + "symfony/framework-bundle": ">=2.4", "symfony/finder": ">=2.2.0" },
0
de4fb3797e133b11198e0d577fd8fec4de740495
1up-lab
OneupUploaderBundle
Fix broken links in doc (#443)
commit de4fb3797e133b11198e0d577fd8fec4de740495 Author: Jérémy DECOOL <[email protected]> Date: Thu Mar 21 08:58:08 2024 +0100 Fix broken links in doc (#443) diff --git a/doc/frontend_blueimp.md b/doc/frontend_blueimp.md index 86ba4ef..69d05a2 100644 --- a/doc/frontend_blueimp.md +++ b/doc/frontend_blueimp.md @@ -46,7 +46,7 @@ security: Next steps ---------- -After this setup, you can move on and implement some of the more advanced features. A full list is available [here](https://github.com/1up-lab/OneupUploaderBundle/blob/main/Resources/doc/index.md#next-steps). +After this setup, you can move on and implement some of the more advanced features. A full list is available [here](https://github.com/1up-lab/OneupUploaderBundle/blob/main/doc/index.md#next-steps). * [Process uploaded files using custom logic](custom_logic.md) * [Return custom data to frontend](response.md) diff --git a/doc/frontend_dropzone.md b/doc/frontend_dropzone.md index e1cb572..1d6302a 100644 --- a/doc/frontend_dropzone.md +++ b/doc/frontend_dropzone.md @@ -26,7 +26,7 @@ Be sure to check out the [official manual](http://www.dropzonejs.com/) for detai Next steps ---------- -After this setup, you can move on and implement some of the more advanced features. A full list is available [here](https://github.com/1up-lab/OneupUploaderBundle/blob/main/Resources/doc/index.md#next-steps). +After this setup, you can move on and implement some of the more advanced features. A full list is available [here](https://github.com/1up-lab/OneupUploaderBundle/blob/main/doc/index.md#next-steps). * [Process uploaded files using custom logic](custom_logic.md) * [Return custom data to frontend](response.md) diff --git a/doc/frontend_fancyupload.md b/doc/frontend_fancyupload.md index 5cf7bb5..95952c1 100644 --- a/doc/frontend_fancyupload.md +++ b/doc/frontend_fancyupload.md @@ -110,7 +110,7 @@ Be sure to check out the [official manual](http://digitarald.de/project/fancyupl Next steps ---------- -After this setup, you can move on and implement some of the more advanced features. A full list is available [here](https://github.com/1up-lab/OneupUploaderBundle/blob/main/Resources/doc/index.md#next-steps). +After this setup, you can move on and implement some of the more advanced features. A full list is available [here](https://github.com/1up-lab/OneupUploaderBundle/blob/main/doc/index.md#next-steps). * [Process uploaded files using custom logic](custom_logic.md) * [Return custom data to frontend](response.md) diff --git a/doc/frontend_fineuploader.md b/doc/frontend_fineuploader.md index 0976de5..fb83118 100644 --- a/doc/frontend_fineuploader.md +++ b/doc/frontend_fineuploader.md @@ -38,7 +38,7 @@ Be sure to check out the [official manual](https://github.com/FineUploader/fine- Next steps ---------- -After this setup, you can move on and implement some of the more advanced features. A full list is available [here](https://github.com/1up-lab/OneupUploaderBundle/blob/main/Resources/doc/index.md#next-steps). +After this setup, you can move on and implement some of the more advanced features. A full list is available [here](https://github.com/1up-lab/OneupUploaderBundle/blob/main/doc/index.md#next-steps). * [Process uploaded files using custom logic](custom_logic.md) * [Return custom data to frontend](response.md) diff --git a/doc/frontend_mooupload.md b/doc/frontend_mooupload.md index 68e1ac0..2f99ca2 100644 --- a/doc/frontend_mooupload.md +++ b/doc/frontend_mooupload.md @@ -37,7 +37,7 @@ Be sure to check out the [official manual](https://github.com/juanparati/MooUplo Next steps ---------- -After this setup, you can move on and implement some of the more advanced features. A full list is available [here](https://github.com/1up-lab/OneupUploaderBundle/blob/main/Resources/doc/index.md#next-steps). +After this setup, you can move on and implement some of the more advanced features. A full list is available [here](https://github.com/1up-lab/OneupUploaderBundle/blob/main/doc/index.md#next-steps). * [Process uploaded files using custom logic](custom_logic.md) * [Return custom data to frontend](response.md) diff --git a/doc/frontend_plupload.md b/doc/frontend_plupload.md index 3dac128..511fcf0 100644 --- a/doc/frontend_plupload.md +++ b/doc/frontend_plupload.md @@ -52,7 +52,7 @@ security: Next steps ---------- -After this setup, you can move on and implement some of the more advanced features. A full list is available [here](https://github.com/1up-lab/OneupUploaderBundle/blob/main/Resources/doc/index.md#next-steps). +After this setup, you can move on and implement some of the more advanced features. A full list is available [here](https://github.com/1up-lab/OneupUploaderBundle/blob/main/doc/index.md#next-steps). * [Process uploaded files using custom logic](custom_logic.md) * [Return custom data to frontend](response.md) diff --git a/doc/frontend_uploadify.md b/doc/frontend_uploadify.md index 0e005d9..70774c6 100644 --- a/doc/frontend_uploadify.md +++ b/doc/frontend_uploadify.md @@ -39,7 +39,7 @@ Be sure to check out the [official manual](http://www.uploadify.com/documentatio Next steps ---------- -After this setup, you can move on and implement some of the more advanced features. A full list is available [here](https://github.com/1up-lab/OneupUploaderBundle/blob/main/Resources/doc/index.md#next-steps). +After this setup, you can move on and implement some of the more advanced features. A full list is available [here](https://github.com/1up-lab/OneupUploaderBundle/blob/main/doc/index.md#next-steps). * [Process uploaded files using custom logic](custom_logic.md) * [Return custom data to frontend](response.md) diff --git a/tests/Uploader/Storage/GaufretteAmazonS3StorageTest.php b/tests/Uploader/Storage/GaufretteAmazonS3StorageTest.php index 3a6c06e..8a4f5c8 100644 --- a/tests/Uploader/Storage/GaufretteAmazonS3StorageTest.php +++ b/tests/Uploader/Storage/GaufretteAmazonS3StorageTest.php @@ -65,8 +65,8 @@ class GaufretteAmazonS3StorageTest extends TestCase fclose($pointer); $service = new AmazonClient([ - 'key' => getenv('AWS_ACCESS_KEY_ID'), - 'secret' => getenv('AWS_SECRET_ACCESS_KEY'), + 'key' => getenv('AWS_ACCESS_KEY_ID'), + 'secret' => getenv('AWS_SECRET_ACCESS_KEY'), ]); $adapter = new S3Adapter($service, getenv('AWS_BUCKET')); $this->filesystem = new GaufretteFilesystem($adapter);
0
13e312a9f059da53094702f5b3e1a25dacccb7a4
1up-lab
OneupUploaderBundle
Added missing instance variables and TypeHinting for constructor variables.
commit 13e312a9f059da53094702f5b3e1a25dacccb7a4 Author: Jim Schmid <[email protected]> Date: Thu Mar 14 17:20:52 2013 +0100 Added missing instance variables and TypeHinting for constructor variables. diff --git a/Uploader/Orphanage/OrphanageManager.php b/Uploader/Orphanage/OrphanageManager.php index 9593d07..13d0d4b 100644 --- a/Uploader/Orphanage/OrphanageManager.php +++ b/Uploader/Orphanage/OrphanageManager.php @@ -4,14 +4,17 @@ namespace Oneup\UploaderBundle\Uploader\Orphanage; use Symfony\Component\Finder\Finder; use Symfony\Component\Filesystem\Filesystem; +use Symfony\Component\DependencyInjection\ContainerInterface; use Oneup\UploaderBundle\Uploader\Orphanage\OrphanageManagerInterface; class OrphanageManager implements OrphanageManagerInterface { + protected $container; + protected $configuration; protected $orphanages; - public function __construct($container, $configuration) + public function __construct(ContainerInterface $container, array $configuration) { $this->container = $container; $this->configuration = $configuration;
0
5e82365a40d187de263c9588693ecf853aa3f32c
1up-lab
OneupUploaderBundle
Added Symfony version 2.4 to testing environments.
commit 5e82365a40d187de263c9588693ecf853aa3f32c Author: Jim Schmid <[email protected]> Date: Wed Dec 4 11:15:38 2013 +0100 Added Symfony version 2.4 to testing environments. diff --git a/.travis.yml b/.travis.yml index fc9e984..3381bd6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,7 @@ php: env: - SYMFONY_VERSION=2.2.* - SYMFONY_VERSION=2.3.* + - SYMFONY_VERSION=2.4.* before_script: - composer require symfony/framework-bundle:${SYMFONY_VERSION} --prefer-source
0
d7350835783f6ff5cd52c491c3a75cf38253e44b
1up-lab
OneupUploaderBundle
Merge pull request #1 from ThomasLandauer/ThomasLandauer-patch-1 Ordered JavaScript libraries by today's relevance
commit d7350835783f6ff5cd52c491c3a75cf38253e44b Merge: 18507cf 4cf7350 Author: Thomas Landauer <[email protected]> Date: Tue Feb 16 21:03:05 2016 +0100 Merge pull request #1 from ThomasLandauer/ThomasLandauer-patch-1 Ordered JavaScript libraries by today's relevance
0
aedb105fd7b3c7ee753cde8def6357b96c78fe9b
1up-lab
OneupUploaderBundle
Removed remove() function as we don't need it anyways.
commit aedb105fd7b3c7ee753cde8def6357b96c78fe9b Author: Jim Schmid <[email protected]> Date: Sat Apr 6 19:28:45 2013 +0200 Removed remove() function as we don't need it anyways. diff --git a/Uploader/Storage/FilesystemStorage.php b/Uploader/Storage/FilesystemStorage.php index 1058a0d..f756476 100644 --- a/Uploader/Storage/FilesystemStorage.php +++ b/Uploader/Storage/FilesystemStorage.php @@ -33,17 +33,4 @@ class FilesystemStorage implements StorageInterface return $file; } - - public function remove($path) - { - $filesystem = new Filesystem(); - - if($filesystem->exists($path)) - { - $filesystem->remove($path); - return true; - } - - return false; - } } \ No newline at end of file diff --git a/Uploader/Storage/GaufretteStorage.php b/Uploader/Storage/GaufretteStorage.php index 76633fb..7f3978e 100644 --- a/Uploader/Storage/GaufretteStorage.php +++ b/Uploader/Storage/GaufretteStorage.php @@ -46,18 +46,4 @@ class GaufretteStorage implements StorageInterface return $this->filesystem->get($path); } - - public function remove($path) - { - try - { - $this->filesystem->delete($path); - } - catch(\RuntimeException $e) - { - return false; - } - - return true; - } } \ No newline at end of file diff --git a/Uploader/Storage/StorageInterface.php b/Uploader/Storage/StorageInterface.php index 96c807c..3684604 100644 --- a/Uploader/Storage/StorageInterface.php +++ b/Uploader/Storage/StorageInterface.php @@ -7,5 +7,4 @@ use Symfony\Component\HttpFoundation\File\File; interface StorageInterface { public function upload(File $file, $name = null, $path = null); - public function remove($path); } \ No newline at end of file
0
5f473e57c65535f2c85aba550c30af1717f7922f
1up-lab
OneupUploaderBundle
Added doc blocks to ReponseInterface
commit 5f473e57c65535f2c85aba550c30af1717f7922f Author: Jim Schmid <[email protected]> Date: Tue Aug 13 16:01:43 2013 +0200 Added doc blocks to ReponseInterface diff --git a/Uploader/Response/ResponseInterface.php b/Uploader/Response/ResponseInterface.php index 135ef3a..517b796 100644 --- a/Uploader/Response/ResponseInterface.php +++ b/Uploader/Response/ResponseInterface.php @@ -4,5 +4,10 @@ namespace Oneup\UploaderBundle\Uploader\Response; interface ResponseInterface { + /** + * Transforms this object to an array of data + * + * @return array + */ public function assemble(); }
0
92cb3219998b1b708c3028009b7439949211564e
1up-lab
OneupUploaderBundle
Add the correct Reference instead of the name of the reference to GaufretteStorage.
commit 92cb3219998b1b708c3028009b7439949211564e Author: Jim Schmid <[email protected]> Date: Fri Apr 5 18:06:14 2013 +0200 Add the correct Reference instead of the name of the reference to GaufretteStorage. diff --git a/DependencyInjection/OneupUploaderExtension.php b/DependencyInjection/OneupUploaderExtension.php index c90c5cd..11e76ac 100644 --- a/DependencyInjection/OneupUploaderExtension.php +++ b/DependencyInjection/OneupUploaderExtension.php @@ -69,7 +69,7 @@ class OneupUploaderExtension extends Extension { $container ->register($storageName, $container->getParameter(sprintf('oneup_uploader.storage.%s.class', $mapping['storage']['type']))) - ->addArgument($mapping['storage']['filesystem']) + ->addArgument(new Reference($mapping['storage']['filesystem'])) ; }
0
8c355cf1a9dfc5ec103193eb022c1c6b90ca9677
1up-lab
OneupUploaderBundle
Documented the testing process.
commit 8c355cf1a9dfc5ec103193eb022c1c6b90ca9677 Author: Jim Schmid <[email protected]> Date: Tue Apr 9 09:08:48 2013 +0200 Documented the testing process. diff --git a/Resources/doc/index.md b/Resources/doc/index.md index 29a4395..c4c35a8 100644 --- a/Resources/doc/index.md +++ b/Resources/doc/index.md @@ -117,5 +117,5 @@ some more advanced features. * Using the Orphanage * [Use Gaufrette as storage layer](gaufrette_storage.md) * [Include your own Namer](custom_namer.md) -* Testing this bundle +* [Testing this bundle](testing.md) * [Configuration Reference](configuration_reference.md) diff --git a/Resources/doc/testing.md b/Resources/doc/testing.md new file mode 100644 index 0000000..8db8597 --- /dev/null +++ b/Resources/doc/testing.md @@ -0,0 +1,62 @@ +Testing the Bundle +================== + +## Install the Environment + +In order to run the UnitTests of this bundle, clone it first + + $> git clone git://github.com/1up-lab/OneupUploaderBundle.git + +After the cloning process, install all vendors by running the corresponding composer command. + + $> php composer.phar udpate --dev + +## Run UnitTests +You can run the unit tests by simply performing the follwowing command. + + $> phpunit + +## Testing Code Coverage +PHPUnit comes bundles with a handy feature to test the code coverage of a project. I recommend using the following configuration to enable the creation of code coverage reports in the `log` directory in the root of this bundle. This directory is gitignored by default. + +Copy the `phpunit.xml.dist` to `phpunit.xml` and use this configuration. + +```xml +<?xml version="1.0" encoding="UTF-8"?> + +<phpunit bootstrap="./Tests/bootstrap.php" colors="true"> + + <testsuites> + <testsuite name="OneupUploaderBundle test suite"> + <directory suffix="Test.php">./Tests</directory> + </testsuite> + </testsuites> + + <filter> + <whitelist> + <directory>./</directory> + <exclude> + <directory>./Command</directory> + <directory>./DependencyInjection</directory> + <directory>./Event</directory> + <directory>./Resources</directory> + <directory>./Tests</directory> + <directory>./vendor</directory> + <directory>./OneupUploaderBundle.php</directory> + </exclude> + </whitelist> + </filter> + + <logging> + <log type="coverage-html" target="./log/codeCoverage" charset="UTF-8" yui="true" highlight="true" + lowUpperBound="50" highLowerBound="80"/> + </logging> + +</phpunit> +``` + +The directories `Command`, `DependencyInjection` and `Event` are excluded from the code coverage report, as these directories contain files that don't necessarily need to be unit tested. + +Run the test suite and generate reports by running: + + $> phpunit \ No newline at end of file
0
f5acda92ea3d6aa482408d1ef65a69f46efb3802
1up-lab
OneupUploaderBundle
Y u no automatic linking Github?
commit f5acda92ea3d6aa482408d1ef65a69f46efb3802 Author: David Greminger <[email protected]> Date: Thu Jan 28 16:06:49 2016 +0100 Y u no automatic linking Github? diff --git a/README.md b/README.md index 3384dae..d0f6ed6 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ The entry point of the documentation can be found in the file `Resources/docs/in Upgrade Notes ------------- -* Version **1.5.0** supports now [Flysystem](https://github.com/1up-lab/OneupFlysystemBundle) (Thank you @[lsv](https://github.com/lsv)! PR #213) and is no longer compatible with PHP 5.3 (it's [EOL](http://php.net/eol.php) since August 2014 anyway). +* Version **1.5.0** supports now [Flysystem](https://github.com/1up-lab/OneupFlysystemBundle) (Thank you @[lsv](https://github.com/lsv)! PR [#213](https://github.com/1up-lab/OneupUploaderBundle/pull/213)) and is no longer compatible with PHP 5.3 (it's [EOL](http://php.net/eol.php) since August 2014 anyway). * Version **v1.0.0** introduced some backward compatibility breaks. For a full list of changes, head to the [dedicated pull request](https://github.com/1up-lab/OneupUploaderBundle/pull/57). * If you're using chunked uploads consider upgrading from **v0.9.6** to **v0.9.7**. A critical issue was reported regarding the assembly of chunks. More information in ticket [#21](https://github.com/1up-lab/OneupUploaderBundle/issues/21#issuecomment-21560320). * Error management [changed](https://github.com/1up-lab/OneupUploaderBundle/pull/25) in Version **0.9.6**. You can now register an `ErrorHandler` per configured frontend. This comes bundled with some adjustments to the `blueimp` controller. More information is available in [the documentation](https://github.com/1up-lab/OneupUploaderBundle/blob/master/Resources/doc/custom_error_handler.md).
0
148be73b118621588fb7a36967e7140d201ea3a9
1up-lab
OneupUploaderBundle
Refactored NamerInterface. Second parameter is now an optional prefix, instead of a mapping array. Loose cupling, yey.
commit 148be73b118621588fb7a36967e7140d201ea3a9 Author: Jim Schmid <[email protected]> Date: Wed Mar 13 08:34:03 2013 +0100 Refactored NamerInterface. Second parameter is now an optional prefix, instead of a mapping array. Loose cupling, yey. diff --git a/Controller/UploaderController.php b/Controller/UploaderController.php index 631ce7e..7314147 100644 --- a/Controller/UploaderController.php +++ b/Controller/UploaderController.php @@ -32,10 +32,7 @@ class UploaderController implements UploadControllerInterface foreach($files as $file) { - // get name and directory and put them together - $name = $this->namer->name($file); - $name = sprintf('%s/%s', $this->config['directory_prefix'], $name); - + $name = $this->namer->name($file, $this->config['directory_prefix']); $this->storage->upload($file, $name); } diff --git a/Uploader/Naming/NamerInterface.php b/Uploader/Naming/NamerInterface.php index 4a7882c..7bbf4d0 100644 --- a/Uploader/Naming/NamerInterface.php +++ b/Uploader/Naming/NamerInterface.php @@ -6,5 +6,5 @@ use Symfony\Component\HttpFoundation\File\UploadedFile; interface NamerInterface { - public function name(UploadedFile $file, array $mapping = array()); + public function name(UploadedFile $file, $prefix = null); } \ No newline at end of file diff --git a/Uploader/Naming/UniqidNamer.php b/Uploader/Naming/UniqidNamer.php index c9b918f..9d9c8b9 100644 --- a/Uploader/Naming/UniqidNamer.php +++ b/Uploader/Naming/UniqidNamer.php @@ -7,8 +7,10 @@ use Oneup\UploaderBundle\Uploader\Naming\NamerInterface; class UniqidNamer implements NamerInterface { - public function name(UploadedFile $file, array $mapping = array()) + public function name(UploadedFile $file, $prefix = null) { - return sprintf('%s.%s', uniqid(), $file->guessExtension()); + $prefix = !is_null($prefix) ? $prefix . '/' : ''; + + return sprintf('%s%s.%s', $prefix, uniqid(), $file->guessExtension()); } } \ No newline at end of file
0
78c7a25b0cd75a6770b00f220bcb6196a930c8b8
1up-lab
OneupUploaderBundle
Removed Symfony 2.3 from test configuration
commit 78c7a25b0cd75a6770b00f220bcb6196a930c8b8 Author: David Greminger <[email protected]> Date: Thu Dec 10 14:23:17 2015 +0100 Removed Symfony 2.3 from test configuration diff --git a/.travis.yml b/.travis.yml index 1734c3f..83d8577 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,6 @@ php: - hhvm env: - - SYMFONY_VERSION=2.3.* - SYMFONY_VERSION=2.7.* - SYMFONY_VERSION=2.8.* @@ -24,8 +23,6 @@ matrix: - env: SYMFONY_VERSION=dev-master include: - - php: 5.6 - env: SYMFONY_VERSION=2.3.* - php: 5.6 env: SYMFONY_VERSION=2.4.* - php: 5.6
0
c5a87ee373d09696d40afacb9cf5b81e8b6b4702
1up-lab
OneupUploaderBundle
don't test for sf2.1
commit c5a87ee373d09696d40afacb9cf5b81e8b6b4702 Author: mitom <[email protected]> Date: Thu Oct 10 20:22:09 2013 +0200 don't test for sf2.1 diff --git a/.travis.yml b/.travis.yml index 0acf73b..fc9e984 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,6 @@ php: - 5.4 env: - - SYMFONY_VERSION=2.1.* - SYMFONY_VERSION=2.2.* - SYMFONY_VERSION=2.3.*
0
17264b2a45f9d6acee144e4369b6abf3e19fea60
1up-lab
OneupUploaderBundle
Merge branch 'robertfausk-patch-1'
commit 17264b2a45f9d6acee144e4369b6abf3e19fea60 Merge: cdc5677 3150571 Author: David Greminger <[email protected]> Date: Tue Nov 7 09:01:54 2017 +0100 Merge branch 'robertfausk-patch-1'
0