-#define NSLCD_REQUEST(fp,action,writefn) \
- /* open a client socket */ \
- if ((fp=nslcd_client_open())==NULL) \
- { ERROR_OUT_OPENERROR } \
- /* write a request header with a request code */ \
- WRITE_INT32(fp,(int32_t)NSLCD_VERSION) \
- WRITE_INT32(fp,(int32_t)action) \
- /* write the request parameters (if any) */ \
- writefn; \
- /* flush the stream */ \
- if (tio_flush(fp)<0) \
- { \
- DEBUG_PRINT("WRITE_FLUSH : error: %s",strerror(errno)); \
- ERROR_OUT_WRITEERROR(fp); \
- } \
- /* read and check response version number */ \
- READ_TYPE(fp,tmpint32,int32_t); \
- if (tmpint32!=(int32_t)NSLCD_VERSION) \
- { ERROR_OUT_READERROR(fp) } \
- /* read and check response request number */ \
- READ_TYPE(fp,tmpint32,int32_t); \
- if (tmpint32!=(int32_t)(action)) \
- { ERROR_OUT_READERROR(fp) }
+#define NSLCD_REQUEST(fp, action, writefn) \
+ /* open a client socket */ \
+ if ((fp = nslcd_client_open()) == NULL) \
+ { \
+ ERROR_OUT_OPENERROR; \
+ } \
+ /* write a request header with a request code */ \
+ WRITE_INT32(fp, (int32_t)NSLCD_VERSION) \
+ WRITE_INT32(fp, (int32_t)action) \
+ /* write the request parameters (if any) */ \
+ writefn; \
+ /* flush the stream */ \
+ if (tio_flush(fp) < 0) \
+ { \
+ DEBUG_PRINT("WRITE_FLUSH : error: %s", strerror(errno)); \
+ ERROR_OUT_WRITEERROR(fp); \
+ } \
+ /* read and check response version number */ \
+ READ(fp, &tmpint32, sizeof(int32_t)); \
+ tmpint32 = ntohl(tmpint32); \
+ if (tmpint32 != (int32_t)NSLCD_VERSION) \
+ { \
+ ERROR_OUT_READERROR(fp); \
+ } \
+ /* read and check response request number */ \
+ READ(fp, &tmpint32, sizeof(int32_t)); \
+ tmpint32 = ntohl(tmpint32); \
+ if (tmpint32 != (int32_t)(action)) \
+ { \
+ ERROR_OUT_READERROR(fp); \
+ }