This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "includes.h"
+#include "smb_krb5.h"
+#include "system/gssapi.h"
+#include "smb_ldap.h"
+#include "libads/ads_status.h"
/*
build a ADS_STATUS structure
if (status.err.rc == LDAP_SUCCESS) {
return NT_STATUS_OK;
}
+ if (status.err.rc == LDAP_TIMELIMIT_EXCEEDED) {
+ return NT_STATUS_IO_TIMEOUT;
+ }
return NT_STATUS_LDAP(status.err.rc);
#endif
#ifdef HAVE_KRB5
*/
const char *ads_errstr(ADS_STATUS status)
{
- static char *ret;
-
- SAFE_FREE(ret);
-
switch (status.error_type) {
case ENUM_ADS_ERROR_SYSTEM:
return strerror(status.err.rc);
#ifdef HAVE_KRB5
case ENUM_ADS_ERROR_KRB5:
return error_message(status.err.rc);
-#endif
-#ifdef HAVE_GSSAPI
case ENUM_ADS_ERROR_GSS:
{
- uint32 msg_ctx;
- uint32 minor;
+ char *ret;
+ uint32_t msg_ctx;
+ uint32_t minor;
gss_buffer_desc msg1, msg2;
msg_ctx = 0;
GSS_C_NULL_OID, &msg_ctx, &msg1);
gss_display_status(&minor, status.minor_status, GSS_C_MECH_CODE,
GSS_C_NULL_OID, &msg_ctx, &msg2);
- asprintf(&ret, "%s : %s", (char *)msg1.value, (char *)msg2.value);
+ ret = talloc_asprintf(talloc_tos(), "%s : %s",
+ (char *)msg1.value, (char *)msg2.value);
+ SMB_ASSERT(ret != NULL);
gss_release_buffer(&minor, &msg1);
gss_release_buffer(&minor, &msg2);
return ret;
default:
return "Unknown ADS error type!? (not compiled in?)";
}
-
}
-
+#ifdef HAVE_KRB5
+NTSTATUS gss_err_to_ntstatus(uint32_t maj, uint32_t min)
+{
+ ADS_STATUS adss = ADS_ERROR_GSS(maj, min);
+ DEBUG(10,("gss_err_to_ntstatus: Error %s\n",
+ ads_errstr(adss) ));
+ return ads_ntstatus(adss);
+}
+#endif