GithubHelp home page GithubHelp logo

Comments (1)

stevenpackardblp avatar stevenpackardblp commented on August 12, 2024

The following patches should allow the module to build on AIX and work well at run time. I can submit them in a pull request if they'd be accepted.

--- a/src/kerberospw.c
+++ b/src/kerberospw.c
@@ -131,24 +131,33 @@
     }
     if (result_code) {
         char *message = NULL;
-        bytes = asprintf(
-            &message, "%.*s: %.*s",
-            (int) result_code_string.length,
-            (char *) result_code_string.data,
-            (int) result_string.length,
-            (char *) result_string.data
-        );
-        if (bytes == -1)
-        {
-            PyErr_NoMemory();
+        int msgSz =
+            (int) result_code_string.length +
+            (int) result_string.length + 2 + 1; // as per format string + null term
+        message = (char *)malloc(msgSz);
+        if (message) {
+            int rc = snprintf(
+                message, msgSz, "%.*s: %.*s",
+                (int) result_code_string.length,
+                (char *) result_code_string.data,
+                (int) result_string.length,
+                (char *) result_string.data
+            );
+            if (rc > 0 && rc <= msgSz) {
+                PyErr_SetObject(
+                    PwdChangeException_class,
+                    Py_BuildValue("((s:i))", message, result_code)
+                );
+            }
+            else
+            {
+                PyErr_NoMemory();
+            }
+            free(message);
         }
         else
         {
-            PyErr_SetObject(
-                PwdChangeException_class,
-                Py_BuildValue("((s:i))", message, result_code)
-            );
-            free(message);
+            PyErr_NoMemory();
         }
         goto end;
     }
--- a/src/kerberosgss.c
+++ b/src/kerberosgss.c
@@ -34,6 +34,14 @@
 extern PyObject *GssException_class;
 extern PyObject *KrbException_class;

+#if defined(__xlC__) || defined(_AIX) || (defined(__SVR4) && defined(__sun))
+void *
+mempcpy (void *dest, const void *src, size_t len)
+{
+    return memcpy (dest, src, len) + len;
+}
+#endif
+
 char* server_principal_details(const char* service, const char* hostname)
 {
     char match[1024];

from ccs-pykerberos.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.