Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. C Makefile warning: passing arg 2 of 'connect' from incompatible pointer type

C Makefile warning: passing arg 2 of 'connect' from incompatible pointer type

Scheduled Pinned Locked Moved C / C++ / MFC
sysadminhelpworkspace
8 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    Office 365
    wrote on last edited by
    #1

    can u help me Sun Directory warning is build file gmake after build gmake show - warning:passing arg 2 of 'connect' from incompatible pointer type id -G -o 64/dpss.so dpss.o Code... #include #include #include #include #include #include #include #include #ifndef _WIN32 #include #endif #include "slapi-plugin.h" #define SLAPD_LOGGING 1 #define _ADD 0 #define _MOD 1 #define _DEL 2 #define _MODRDN 3 Slapi_PluginDesc DPSS_desc = { "DPSS", /* plug-in identifier */ "DThai Professional Services", /* vendor name */ "1.0", /* plug-in revision number */ "capture password change plugin" /* plug-in description */ }; static Slapi_ComponentId * DPSS_id; /* Used to set log */ char * changelogfile = NULL; /* Write changes to this file */ char * changelogfile2 = NULL; /* Write changes to this file */ char **argument; /* receive username and port */ #define NULL_CHANGELOG_WARNING_ID 0L #define CANNOT_APPEND_TO_CHANGELOG_WARNING_ID 1L /* Current time is a function defined in the server */ time_t current_time(void); /* Initialization function before write log file */ int DPSS_set_log(Slapi_PBlock * pb); /* Log the DN of the added entry */ int DPSS_add(Slapi_PBlock * pb); /* Log the DN of the modified entry */ int DPSS_mod(Slapi_PBlock * pb); /* Logs information on an operation to a change log file */ static void write_changelog(int optype, char *dn, void *change); /* get the DS errorlog path by reading configuration entry */ /* which has dn=config and find nsslapd-errorlog attribute */ /* then create changelogfile path near the errorlog */ int DPSS_set_log(Slapi_PBlock * pb) { Slapi_DN * confdn = NULL; /* DN for configuration entry */ Slapi_Entry * config = NULL; /* Configuration entry */ char * errlog = NULL; /* Errors log file name */ char * logdir = NULL; /* Errors log directory name */ FILE * fp; /* Use to open changelog file */ int rc = 0; /* Use to check success */ #ifdef _WIN32 char drive[_MAX_DRIVE]; /* Windows di

    L 1 Reply Last reply
    0
    • O Office 365

      can u help me Sun Directory warning is build file gmake after build gmake show - warning:passing arg 2 of 'connect' from incompatible pointer type id -G -o 64/dpss.so dpss.o Code... #include #include #include #include #include #include #include #include #ifndef _WIN32 #include #endif #include "slapi-plugin.h" #define SLAPD_LOGGING 1 #define _ADD 0 #define _MOD 1 #define _DEL 2 #define _MODRDN 3 Slapi_PluginDesc DPSS_desc = { "DPSS", /* plug-in identifier */ "DThai Professional Services", /* vendor name */ "1.0", /* plug-in revision number */ "capture password change plugin" /* plug-in description */ }; static Slapi_ComponentId * DPSS_id; /* Used to set log */ char * changelogfile = NULL; /* Write changes to this file */ char * changelogfile2 = NULL; /* Write changes to this file */ char **argument; /* receive username and port */ #define NULL_CHANGELOG_WARNING_ID 0L #define CANNOT_APPEND_TO_CHANGELOG_WARNING_ID 1L /* Current time is a function defined in the server */ time_t current_time(void); /* Initialization function before write log file */ int DPSS_set_log(Slapi_PBlock * pb); /* Log the DN of the added entry */ int DPSS_add(Slapi_PBlock * pb); /* Log the DN of the modified entry */ int DPSS_mod(Slapi_PBlock * pb); /* Logs information on an operation to a change log file */ static void write_changelog(int optype, char *dn, void *change); /* get the DS errorlog path by reading configuration entry */ /* which has dn=config and find nsslapd-errorlog attribute */ /* then create changelogfile path near the errorlog */ int DPSS_set_log(Slapi_PBlock * pb) { Slapi_DN * confdn = NULL; /* DN for configuration entry */ Slapi_Entry * config = NULL; /* Configuration entry */ char * errlog = NULL; /* Errors log file name */ char * logdir = NULL; /* Errors log directory name */ FILE * fp; /* Use to open changelog file */ int rc = 0; /* Use to check success */ #ifdef _WIN32 char drive[_MAX_DRIVE]; /* Windows di

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Please do not dump a huge block of code like this and expect people to debug it for you. Edit your question and remove all the lines that are not relevant to your problem. Place <pre> tags around the remaining code so it is readable, and show clearly which is the line in error.

      O 1 Reply Last reply
      0
      • L Lost User

        Please do not dump a huge block of code like this and expect people to debug it for you. Edit your question and remove all the lines that are not relevant to your problem. Place <pre> tags around the remaining code so it is readable, and show clearly which is the line in error.

        O Offline
        O Offline
        Office 365
        wrote on last edited by
        #3

        Edit already Can U help Me Please....

        L 1 Reply Last reply
        0
        • O Office 365

          Edit already Can U help Me Please....

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Well, you did not remove all the code that is not relevant. However your second parameter on the connect call is defined as a struct sockaddr_in* but according to the documentation[^] it should be a struct sockaddr*.

          O 1 Reply Last reply
          0
          • L Lost User

            Well, you did not remove all the code that is not relevant. However your second parameter on the connect call is defined as a struct sockaddr_in* but according to the documentation[^] it should be a struct sockaddr*.

            O Offline
            O Offline
            Office 365
            wrote on last edited by
            #5

            Give i do this ==> Yes or not

            if (connect(sockfd,(struct sockaddr *)&serv_addr,sizeof(serv_addr)) < 0) { //เพิ่ม (struct sockaddr *) เข้าไป
            //error("ERROR connecting");
            close(sockfd);
            return(0);
            }

            L 1 Reply Last reply
            0
            • O Office 365

              Give i do this ==> Yes or not

              if (connect(sockfd,(struct sockaddr *)&serv_addr,sizeof(serv_addr)) < 0) { //เพิ่ม (struct sockaddr *) เข้าไป
              //error("ERROR connecting");
              close(sockfd);
              return(0);
              }

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              Yes you can do that but you need to check that both structures are exactly the same in both content and size.

              O 1 Reply Last reply
              0
              • L Lost User

                Yes you can do that but you need to check that both structures are exactly the same in both content and size.

                O Offline
                O Offline
                Office 365
                wrote on last edited by
                #7

                thank so Must...but you can help solution me again Please?? Now gmkae build file dpss.c not warning already..but Plugin Me cann't sent password to protocal LDAP From Sun to Active Directory not have event log... I don't know sun directory need config port same function send_message

                int send_message(char* message)
                {
                char* ip = "172.32.5.107";
                char* port = "12199";

                if (argument\[0\] != NULL)
                	ip = argument\[0\];
                if (argument\[1\] != NULL)
                	port = argument\[1\];
                
                int sockfd, portno, n;
                struct sockaddr\_in serv\_addr;  
                struct hostent \*server;
                
                char buffer\[256\];
                portno = atoi(port);
                sockfd = socket(AF\_INET, SOCK\_STREAM, 0);
                if (sockfd < 0)
                {
                    error("ERROR opening socket");
                	exit(0);
                }
                else
                {
                	server = gethostbyname(ip);
                	if (server == NULL) {
                    	//fprintf(stderr,"ERROR, no such host\\n");
                    	//exit(0);
                		close(sockfd);
                		return(0);
                	}
                	bzero((char \*) &serv\_addr, sizeof(serv\_addr));		
                	serv\_addr.sin\_family = AF\_INET;
                	
                	bcopy((char \*)server->h\_addr, 
                     	(char \*)&serv\_addr.sin\_addr.s\_addr,
                     	server->h\_length);		
                	serv\_addr.sin\_port = htons(portno);		
                
                	if (connect(sockfd,(struct sockaddr \*)&serv\_addr,sizeof(serv\_addr)) < 0) {  //เพิ่ม (struct sockaddr \*) เข้าไป
                    	//error("ERROR connecting");			
                		close(sockfd);			
                		return(0);
                	}		
                	bzero(buffer,256);
                	n = write(sockfd,message,strlen(message));
                	//if (n < 0)
                	//     error("ERROR writing to socket");
                	bzero(buffer,256);
                	//n = read(sockfd,buffer,255);
                	//if (n < 0) 
                    	//error("ERROR reading from socket");
                	
                	//printf("%s\\n",buffer);
                }	
                close(sockfd);	
                return 0;
                

                }

                L 1 Reply Last reply
                0
                • O Office 365

                  thank so Must...but you can help solution me again Please?? Now gmkae build file dpss.c not warning already..but Plugin Me cann't sent password to protocal LDAP From Sun to Active Directory not have event log... I don't know sun directory need config port same function send_message

                  int send_message(char* message)
                  {
                  char* ip = "172.32.5.107";
                  char* port = "12199";

                  if (argument\[0\] != NULL)
                  	ip = argument\[0\];
                  if (argument\[1\] != NULL)
                  	port = argument\[1\];
                  
                  int sockfd, portno, n;
                  struct sockaddr\_in serv\_addr;  
                  struct hostent \*server;
                  
                  char buffer\[256\];
                  portno = atoi(port);
                  sockfd = socket(AF\_INET, SOCK\_STREAM, 0);
                  if (sockfd < 0)
                  {
                      error("ERROR opening socket");
                  	exit(0);
                  }
                  else
                  {
                  	server = gethostbyname(ip);
                  	if (server == NULL) {
                      	//fprintf(stderr,"ERROR, no such host\\n");
                      	//exit(0);
                  		close(sockfd);
                  		return(0);
                  	}
                  	bzero((char \*) &serv\_addr, sizeof(serv\_addr));		
                  	serv\_addr.sin\_family = AF\_INET;
                  	
                  	bcopy((char \*)server->h\_addr, 
                       	(char \*)&serv\_addr.sin\_addr.s\_addr,
                       	server->h\_length);		
                  	serv\_addr.sin\_port = htons(portno);		
                  
                  	if (connect(sockfd,(struct sockaddr \*)&serv\_addr,sizeof(serv\_addr)) < 0) {  //เพิ่ม (struct sockaddr \*) เข้าไป
                      	//error("ERROR connecting");			
                  		close(sockfd);			
                  		return(0);
                  	}		
                  	bzero(buffer,256);
                  	n = write(sockfd,message,strlen(message));
                  	//if (n < 0)
                  	//     error("ERROR writing to socket");
                  	bzero(buffer,256);
                  	//n = read(sockfd,buffer,255);
                  	//if (n < 0) 
                      	//error("ERROR reading from socket");
                  	
                  	//printf("%s\\n",buffer);
                  }	
                  close(sockfd);	
                  return 0;
                  

                  }

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #8

                  Sorry, I don't understand your question.

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups