- /* Do "IDENT" (aka "AUTH") lookup and write result to parent */
- Log_Resolver( LOG_DEBUG, "Doing IDENT lookup on socket %d ...", Sock );
- res = ident_id( Sock, 10 );
- Log_Resolver( LOG_DEBUG, "Ok, IDENT lookup on socket %d done: \"%s\"", Sock, res ? res : "" );
-
- /* Write IDENT result into pipe to parent */
- if (res) {
- len = strlen(res);
- res[len] = '\n';
- len++;
- } else len = 1;
-
- if( (size_t)write( w_fd, res ? res : "\n", len ) != (size_t)len )
- {
- Log_Resolver( LOG_CRIT, "Resolver: Can't write to parent (IDENT): %s!", strerror( errno ));
- close( w_fd );
+ assert(identsock >= 0);
+ if (identsock >= 0) {
+ /* Do "IDENT" (aka "AUTH") lookup and append result to resolved_addr array */
+#ifdef DEBUG
+ Log_Resolver( LOG_DEBUG, "Doing IDENT lookup on socket %d ...", identsock );
+#endif
+ res = ident_id( identsock, 10 );
+#ifdef DEBUG
+ Log_Resolver(LOG_DEBUG, "Ok, IDENT lookup on socket %d done: \"%s\"",
+ identsock, res ? res : "(NULL)" );
+#endif
+ if (res && !array_cats(&resolved_addr, res)) {
+ Log_Resolver(LOG_WARNING, "Resolver: Cannot copy IDENT result: %s!", strerror(errno));
+ /* omit ident and return hostname only */
+ }
+
+ if (res) free(res);