]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/auth/basic/RADIUS/basic_radius_auth.cc
Maintenance: Removed most NULLs using modernize-use-nullptr (#1075)
[thirdparty/squid.git] / src / auth / basic / RADIUS / basic_radius_auth.cc
index 27264b6ef3e77383531cf016ba601a0dcf793b7e..67bbbec0284c8072e89a1447070ee33db26f9c30 100644 (file)
@@ -143,7 +143,7 @@ static int
 time_since(const struct timeval *when)
 {
     struct timeval now;
-    gettimeofday(&now, NULL);
+    gettimeofday(&now, nullptr);
     return timeval_diff(when, &now);
 }
 
@@ -206,7 +206,7 @@ result_recv(char *buffer, int length)
 static void
 random_vector(char *aVector)
 {
-    static std::mt19937 mt(time(0));
+    static std::mt19937 mt(time(nullptr));
     static xuniform_int_distribution<uint8_t> dist;
 
     for (int i = 0; i < AUTH_VECTOR_LEN; ++i)
@@ -227,11 +227,11 @@ rad_auth_config(const char *cfname)
     char line[MAXLINE];
     int srv = 0, crt = 0;
 
-    if ((cf = fopen(cfname, "r")) == NULL) {
+    if ((cf = fopen(cfname, "r")) == nullptr) {
         perror(cfname);
         return -1;
     }
-    while (fgets(line, MAXLINE, cf) != NULL) {
+    while (fgets(line, MAXLINE, cf) != nullptr) {
         if (!memcmp(line, "server", 6))
             srv = sscanf(line, "server %s", server);
         if (!memcmp(line, "secret", 6))
@@ -263,7 +263,7 @@ urldecode(char *dst, const char *src, int size)
             ++src;
             tmp[1] = *src;
             ++src;
-            *dst = strtol(tmp, NULL, 16);
+            *dst = strtol(tmp, nullptr, 16);
             ++dst;
         } else {
             *dst = *src;
@@ -416,7 +416,7 @@ authenticate(int socket_fd, const char *username, const char *passwd)
         /*
          *    Send the request we've built.
          */
-        gettimeofday(&sent, NULL);
+        gettimeofday(&sent, nullptr);
         if (send(socket_fd, (char *) auth, total_length, 0) < 0) {
             int xerrno = errno;
             // EAGAIN is expected at high traffic, just retry
@@ -437,7 +437,7 @@ authenticate(int socket_fd, const char *username, const char *passwd)
             }
             FD_ZERO(&readfds);
             FD_SET(socket_fd, &readfds);
-            if (select(socket_fd + 1, &readfds, NULL, NULL, &tv) == 0)  /* Select timeout */
+            if (select(socket_fd + 1, &readfds, nullptr, nullptr, &tv) == 0)  /* Select timeout */
                 break;
             salen = sizeof(saremote);
             len = recvfrom(socket_fd, recv_buffer, sizeof(i_recv_buffer),
@@ -474,7 +474,7 @@ main(int argc, char **argv)
     char passwd[MAXPASS];
     char *ptr;
     char buf[HELPER_INPUT_BUFFER];
-    const char *cfname = NULL;
+    const char *cfname = nullptr;
     int err = 0;
     socklen_t salen;
     int c;
@@ -509,7 +509,7 @@ main(int argc, char **argv)
         }
     }
     /* make standard output line buffered */
-    if (setvbuf(stdout, NULL, _IOLBF, 0) != 0)
+    if (setvbuf(stdout, nullptr, _IOLBF, 0) != 0)
         exit(EXIT_FAILURE);
 
     if (cfname) {
@@ -537,7 +537,7 @@ main(int argc, char **argv)
      *    Open a connection to the server.
      */
     svp = getservbyname(svc_name, "udp");
-    if (svp != NULL)
+    if (svp != nullptr)
         svc_port = ntohs((unsigned short) svp->s_port);
     else
         svc_port = atoi(svc_name);
@@ -576,10 +576,10 @@ main(int argc, char **argv)
     }
 #endif
     nas_ipaddr = ntohl(salocal.sin_addr.s_addr);
-    while (fgets(buf, HELPER_INPUT_BUFFER, stdin) != NULL) {
+    while (fgets(buf, HELPER_INPUT_BUFFER, stdin) != nullptr) {
         char *end;
         /* protect me form to long lines */
-        if ((end = strchr(buf, '\n')) == NULL) {
+        if ((end = strchr(buf, '\n')) == nullptr) {
             err = 1;
             continue;
         }
@@ -599,7 +599,7 @@ main(int argc, char **argv)
         ptr = buf;
         while (isspace(*ptr))
             ++ptr;
-        if ((end = strchr(ptr, ' ')) == NULL) {
+        if ((end = strchr(ptr, ' ')) == nullptr) {
             SEND_ERR("No password");
             continue;
         }