File: | krb5module.c |
Function: | Context_sendauth |
Error: | ob_refcnt of '*ctx' is 1 too high |
1074 static PyObject*
1075 Context_sendauth(PyObject *unself, PyObject *args, PyObject *kw)
1076 {
1077 krb5_context kctx = NULL;
1078 PyObject *ctx, *retval, *self, *fd_obj = NULL, *options = NULL, *server = NULL, *client = NULL, *ccacheo = NULL, *tmp, *in_data = NULL;
1079 krb5_auth_context ac_out = NULL;
1080 krb5_ccache ccache;
1081 krb5_principal pclient, pserver;
1082 krb5_flags ap_req_options = 0;
1083 krb5_data inbuf;
1084 int free_pclient = 0;
1085 krb5_error_code rc = 0;
1086 int free_ccacheo = 0;
1087 char *appl_version;
1088 int fd;
1089 krb5_pointer fd_ptr = &fd;
1090
1091 if(!PyArg_ParseTuple(args, "OOs:sendauth", &self, &fd_obj, &appl_version))
when PyArg_ParseTuple() succeeds
taking False path
1092 return NULL;
1093
1094 fd = obj_to_fd(fd_obj);
1095 if(fd < 0)
when considering range: 0 <= value <= 0x7fffffff
taking False path
1096 return NULL;
1097
1098 ctx = PyObject_GetAttrString(self, "_ctx");
when PyObject_GetAttrString() succeeds
new ref from call to PyObject_GetAttrString allocated at: ctx = PyObject_GetAttrString(self, "_ctx");
ob_refcnt is now refs: 1 + N where N >= 0
1099 kctx = PyCObject_AsVoidPtr(ctx);
when PyCObject_AsVoidPtr() returns
1100
1101 if(kw)
taking True path
1102 {
1103 options = PyDict_GetItemString(kw, "options");
when PyDict_GetItemString() succeeds
1104 server = PyDict_GetItemString(kw, "server");
when PyDict_GetItemString() succeeds
1105 client = PyDict_GetItemString(kw, "client");
when PyDict_GetItemString() succeeds
1106 ccacheo = PyDict_GetItemString(kw, "ccache");
when PyDict_GetItemString() succeeds
1107 in_data = PyDict_GetItemString(kw, "data");
when PyDict_GetItemString() succeeds
1108 }
1109
1110 if(!ccacheo)
taking False path
1111 {
1112 PyObject *subargs;
1113 subargs = Py_BuildValue("(O)", self);
1114 ccacheo = Context_cc_default(unself, subargs, NULL);
1115 Py_DECREF(subargs);
1116 free_ccacheo = 1;
1117 }
1118 tmp = PyObject_GetAttrString(ccacheo, "_ccache");
when PyObject_GetAttrString() succeeds
1119 ccache = PyCObject_AsVoidPtr(tmp);
when PyCObject_AsVoidPtr() returns
1120 if(free_ccacheo)
taking False path
1121 {
1122 Py_DECREF(ccacheo);
1123 }
1124 if(client)
taking True path
1125 {
1126 tmp = PyObject_GetAttrString(client, "_princ");
when PyObject_GetAttrString() succeeds
1127 pclient = PyCObject_AsVoidPtr(tmp);
when PyCObject_AsVoidPtr() returns
1128 }
1129 else
1130 {
1131 rc = krb5_cc_get_principal(kctx, ccache, &pclient);
1132 if(rc)
1133 return pk_error(rc);
1134 free_pclient = 1;
1135 }
1136
1137 if(server)
taking True path
1138 {
1139 tmp = PyObject_GetAttrString(server, "_princ");
when PyObject_GetAttrString() succeeds
1140 pserver = PyCObject_AsVoidPtr(tmp);
when PyCObject_AsVoidPtr() returns
1141 }
1142 else
1143 {
1144 PyErr_Format(PyExc_TypeError, "A server keyword argument is required");
1145 return NULL;
1146 }
1147 if(options)
taking True path
1148 ap_req_options = PyInt_AsLong(options);
when PyInt_AsLong() succeeds
1149 if(in_data)
taking True path
1150 {
1151 if(!PyString_Check(in_data))
when considering range: 1 <= value <= 0x8000000
taking False path
1152 {
1153 PyErr_Format(PyExc_TypeError, "data must be a string type");
1154 return NULL;
1155 }
1156
1157 inbuf.data = PyString_AsString(in_data);
when PyString_AsString() succeeds
1158 inbuf.length = PyString_Size(in_data);
when PyString_Size() succeeds
1159 }
1160 else
1161 {
1162 inbuf.data = "BLANK";
1163 inbuf.length = 5;
1164 }
1165
1166 Py_BEGIN_ALLOW_THREADS
releasing the GIL by calling PyEval_SaveThread()
1167 rc = krb5_sendauth(kctx, &ac_out, fd_ptr, appl_version, pclient, pserver, ap_req_options, &inbuf,
1168 NULL, ccache, NULL, NULL, NULL);
1169 Py_END_ALLOW_THREADS
reacquiring the GIL by calling PyEval_RestoreThread()
1170 if(free_pclient)
taking False path
1171 krb5_free_principal(kctx, pclient);
1172 if(rc)
when considering value == (krb5_error_code)0 from krb5module.c:1167
taking False path
1173 return pk_error(rc);
1174
1175 {
1176 PyObject *subargs, *mykw = NULL, *otmp;
1177
1178 /* build & run a python call: AuthContext( context=self, ac=ac_out). */
1179 /* this makes a copy of sendauth's updated version of the client's auth_context. */
1180 /* Context.sendauth() returns this updated auth_context. */
1181 subargs = Py_BuildValue("()");
when Py_BuildValue() succeeds
1182 mykw = PyDict_New();
when PyDict_New() succeeds
1183 PyDict_SetItemString(mykw, "context", self);
when PyDict_SetItemString() succeeds
1184 otmp = PyCObject_FromVoidPtrAndDesc(ac_out, kctx, destroy_ac);
when PyCObject_FromVoidPtrAndDesc() succeeds
1185 PyDict_SetItemString(mykw, "ac", otmp);
when PyDict_SetItemString() succeeds
1186 retval = PyEval_CallObjectWithKeywords(auth_context_class, subargs, mykw);
when treating unknown struct PyObject * from krb5module.c:34 as non-NULL
when PyEval_CallObjectWithKeywords() fails
1187 Py_DECREF(otmp);
when taking True path
1188 Py_DECREF(subargs);
when taking True path
1189 Py_XDECREF(mykw);
taking False path
when taking True path
1190 }
1191
1192 return retval;
1193 } /* KrbV.Context.sendauth() */
ob_refcnt of '*ctx' is 1 too high
was expecting final ob_refcnt to be N + 0 (for some unknown N)
but final ob_refcnt is N + 1
found 14 similar trace(s) to this
File: | krb5module.c |
Function: | Context_sendauth |
Error: | ob_refcnt of new ref from call to PyObject_GetAttrString is 1 too high |
1074 static PyObject*
1075 Context_sendauth(PyObject *unself, PyObject *args, PyObject *kw)
1076 {
1077 krb5_context kctx = NULL;
1078 PyObject *ctx, *retval, *self, *fd_obj = NULL, *options = NULL, *server = NULL, *client = NULL, *ccacheo = NULL, *tmp, *in_data = NULL;
1079 krb5_auth_context ac_out = NULL;
1080 krb5_ccache ccache;
1081 krb5_principal pclient, pserver;
1082 krb5_flags ap_req_options = 0;
1083 krb5_data inbuf;
1084 int free_pclient = 0;
1085 krb5_error_code rc = 0;
1086 int free_ccacheo = 0;
1087 char *appl_version;
1088 int fd;
1089 krb5_pointer fd_ptr = &fd;
1090
1091 if(!PyArg_ParseTuple(args, "OOs:sendauth", &self, &fd_obj, &appl_version))
when PyArg_ParseTuple() succeeds
taking False path
1092 return NULL;
1093
1094 fd = obj_to_fd(fd_obj);
1095 if(fd < 0)
when considering range: 0 <= value <= 0x7fffffff
taking False path
1096 return NULL;
1097
1098 ctx = PyObject_GetAttrString(self, "_ctx");
when PyObject_GetAttrString() succeeds
1099 kctx = PyCObject_AsVoidPtr(ctx);
when PyCObject_AsVoidPtr() returns
1100
1101 if(kw)
taking True path
1102 {
1103 options = PyDict_GetItemString(kw, "options");
when PyDict_GetItemString() succeeds
1104 server = PyDict_GetItemString(kw, "server");
when PyDict_GetItemString() succeeds
1105 client = PyDict_GetItemString(kw, "client");
when PyDict_GetItemString() succeeds
1106 ccacheo = PyDict_GetItemString(kw, "ccache");
when PyDict_GetItemString() succeeds
1107 in_data = PyDict_GetItemString(kw, "data");
when PyDict_GetItemString() succeeds
1108 }
1109
1110 if(!ccacheo)
taking False path
1111 {
1112 PyObject *subargs;
1113 subargs = Py_BuildValue("(O)", self);
1114 ccacheo = Context_cc_default(unself, subargs, NULL);
1115 Py_DECREF(subargs);
1116 free_ccacheo = 1;
1117 }
1118 tmp = PyObject_GetAttrString(ccacheo, "_ccache");
when PyObject_GetAttrString() succeeds
new ref from call to PyObject_GetAttrString allocated at: tmp = PyObject_GetAttrString(ccacheo, "_ccache");
ob_refcnt is now refs: 1 + N where N >= 0
1119 ccache = PyCObject_AsVoidPtr(tmp);
when PyCObject_AsVoidPtr() returns
1120 if(free_ccacheo)
taking False path
1121 {
1122 Py_DECREF(ccacheo);
1123 }
1124 if(client)
taking True path
1125 {
1126 tmp = PyObject_GetAttrString(client, "_princ");
when PyObject_GetAttrString() succeeds
1127 pclient = PyCObject_AsVoidPtr(tmp);
when PyCObject_AsVoidPtr() returns
1128 }
1129 else
1130 {
1131 rc = krb5_cc_get_principal(kctx, ccache, &pclient);
1132 if(rc)
1133 return pk_error(rc);
1134 free_pclient = 1;
1135 }
1136
1137 if(server)
taking True path
1138 {
1139 tmp = PyObject_GetAttrString(server, "_princ");
when PyObject_GetAttrString() succeeds
1140 pserver = PyCObject_AsVoidPtr(tmp);
when PyCObject_AsVoidPtr() returns
1141 }
1142 else
1143 {
1144 PyErr_Format(PyExc_TypeError, "A server keyword argument is required");
1145 return NULL;
1146 }
1147 if(options)
taking True path
1148 ap_req_options = PyInt_AsLong(options);
when PyInt_AsLong() succeeds
1149 if(in_data)
taking True path
1150 {
1151 if(!PyString_Check(in_data))
when considering range: 1 <= value <= 0x8000000
taking False path
1152 {
1153 PyErr_Format(PyExc_TypeError, "data must be a string type");
1154 return NULL;
1155 }
1156
1157 inbuf.data = PyString_AsString(in_data);
when PyString_AsString() succeeds
1158 inbuf.length = PyString_Size(in_data);
when PyString_Size() succeeds
1159 }
1160 else
1161 {
1162 inbuf.data = "BLANK";
1163 inbuf.length = 5;
1164 }
1165
1166 Py_BEGIN_ALLOW_THREADS
releasing the GIL by calling PyEval_SaveThread()
1167 rc = krb5_sendauth(kctx, &ac_out, fd_ptr, appl_version, pclient, pserver, ap_req_options, &inbuf,
1168 NULL, ccache, NULL, NULL, NULL);
1169 Py_END_ALLOW_THREADS
reacquiring the GIL by calling PyEval_RestoreThread()
1170 if(free_pclient)
taking False path
1171 krb5_free_principal(kctx, pclient);
1172 if(rc)
when considering value == (krb5_error_code)0 from krb5module.c:1167
taking False path
1173 return pk_error(rc);
1174
1175 {
1176 PyObject *subargs, *mykw = NULL, *otmp;
1177
1178 /* build & run a python call: AuthContext( context=self, ac=ac_out). */
1179 /* this makes a copy of sendauth's updated version of the client's auth_context. */
1180 /* Context.sendauth() returns this updated auth_context. */
1181 subargs = Py_BuildValue("()");
when Py_BuildValue() succeeds
1182 mykw = PyDict_New();
when PyDict_New() succeeds
1183 PyDict_SetItemString(mykw, "context", self);
when PyDict_SetItemString() succeeds
1184 otmp = PyCObject_FromVoidPtrAndDesc(ac_out, kctx, destroy_ac);
when PyCObject_FromVoidPtrAndDesc() succeeds
1185 PyDict_SetItemString(mykw, "ac", otmp);
when PyDict_SetItemString() succeeds
1186 retval = PyEval_CallObjectWithKeywords(auth_context_class, subargs, mykw);
when treating unknown struct PyObject * from krb5module.c:34 as non-NULL
when PyEval_CallObjectWithKeywords() fails
1187 Py_DECREF(otmp);
when taking True path
1188 Py_DECREF(subargs);
when taking True path
1189 Py_XDECREF(mykw);
taking False path
when taking True path
1190 }
1191
1192 return retval;
1193 } /* KrbV.Context.sendauth() */
ob_refcnt of new ref from call to PyObject_GetAttrString is 1 too high
was expecting final ob_refcnt to be N + 0 (for some unknown N)
but final ob_refcnt is N + 1
found 44 similar trace(s) to this
File: | krb5module.c |
Function: | Context_sendauth |
Error: | returning (PyObject*)NULL without setting an exception |
1074 static PyObject*
1075 Context_sendauth(PyObject *unself, PyObject *args, PyObject *kw)
1076 {
1077 krb5_context kctx = NULL;
1078 PyObject *ctx, *retval, *self, *fd_obj = NULL, *options = NULL, *server = NULL, *client = NULL, *ccacheo = NULL, *tmp, *in_data = NULL;
1079 krb5_auth_context ac_out = NULL;
1080 krb5_ccache ccache;
1081 krb5_principal pclient, pserver;
1082 krb5_flags ap_req_options = 0;
1083 krb5_data inbuf;
1084 int free_pclient = 0;
1085 krb5_error_code rc = 0;
1086 int free_ccacheo = 0;
1087 char *appl_version;
1088 int fd;
1089 krb5_pointer fd_ptr = &fd;
1090
1091 if(!PyArg_ParseTuple(args, "OOs:sendauth", &self, &fd_obj, &appl_version))
when PyArg_ParseTuple() succeeds
taking False path
1092 return NULL;
1093
1094 fd = obj_to_fd(fd_obj);
1095 if(fd < 0)
when considering range: -0x80000000 <= value <= -1
taking True path
1096 return NULL;
1097
1098 ctx = PyObject_GetAttrString(self, "_ctx");
1099 kctx = PyCObject_AsVoidPtr(ctx);
1100
1101 if(kw)
1102 {
1103 options = PyDict_GetItemString(kw, "options");
1104 server = PyDict_GetItemString(kw, "server");
1105 client = PyDict_GetItemString(kw, "client");
1106 ccacheo = PyDict_GetItemString(kw, "ccache");
1107 in_data = PyDict_GetItemString(kw, "data");
1108 }
1109
1110 if(!ccacheo)
1111 {
1112 PyObject *subargs;
1113 subargs = Py_BuildValue("(O)", self);
1114 ccacheo = Context_cc_default(unself, subargs, NULL);
1115 Py_DECREF(subargs);
1116 free_ccacheo = 1;
1117 }
1118 tmp = PyObject_GetAttrString(ccacheo, "_ccache");
1119 ccache = PyCObject_AsVoidPtr(tmp);
1120 if(free_ccacheo)
1121 {
1122 Py_DECREF(ccacheo);
1123 }
1124 if(client)
1125 {
1126 tmp = PyObject_GetAttrString(client, "_princ");
1127 pclient = PyCObject_AsVoidPtr(tmp);
1128 }
1129 else
1130 {
1131 rc = krb5_cc_get_principal(kctx, ccache, &pclient);
1132 if(rc)
1133 return pk_error(rc);
1134 free_pclient = 1;
1135 }
1136
1137 if(server)
1138 {
1139 tmp = PyObject_GetAttrString(server, "_princ");
1140 pserver = PyCObject_AsVoidPtr(tmp);
1141 }
1142 else
1143 {
1144 PyErr_Format(PyExc_TypeError, "A server keyword argument is required");
1145 return NULL;
1146 }
1147 if(options)
1148 ap_req_options = PyInt_AsLong(options);
1149 if(in_data)
1150 {
1151 if(!PyString_Check(in_data))
1152 {
1153 PyErr_Format(PyExc_TypeError, "data must be a string type");
1154 return NULL;
1155 }
1156
1157 inbuf.data = PyString_AsString(in_data);
1158 inbuf.length = PyString_Size(in_data);
1159 }
1160 else
1161 {
1162 inbuf.data = "BLANK";
1163 inbuf.length = 5;
1164 }
1165
1166 Py_BEGIN_ALLOW_THREADS
1167 rc = krb5_sendauth(kctx, &ac_out, fd_ptr, appl_version, pclient, pserver, ap_req_options, &inbuf,
1168 NULL, ccache, NULL, NULL, NULL);
1169 Py_END_ALLOW_THREADS
1170 if(free_pclient)
1171 krb5_free_principal(kctx, pclient);
1172 if(rc)
1173 return pk_error(rc);
1174
1175 {
1176 PyObject *subargs, *mykw = NULL, *otmp;
1177
1178 /* build & run a python call: AuthContext( context=self, ac=ac_out). */
1179 /* this makes a copy of sendauth's updated version of the client's auth_context. */
1180 /* Context.sendauth() returns this updated auth_context. */
1181 subargs = Py_BuildValue("()");
1182 mykw = PyDict_New();
1183 PyDict_SetItemString(mykw, "context", self);
1184 otmp = PyCObject_FromVoidPtrAndDesc(ac_out, kctx, destroy_ac);
1185 PyDict_SetItemString(mykw, "ac", otmp);
1186 retval = PyEval_CallObjectWithKeywords(auth_context_class, subargs, mykw);
1187 Py_DECREF(otmp);
1188 Py_DECREF(subargs);
1189 Py_XDECREF(mykw);
1190 }
1191
1192 return retval;
1193 } /* KrbV.Context.sendauth() */
returning (PyObject*)NULL without setting an exception