diff --git a/netcam_rtsp.c b/netcam_rtsp.c index 325890dd..27d02272 100644 --- a/netcam_rtsp.c +++ b/netcam_rtsp.c @@ -282,7 +282,7 @@ static int netcam_interrupt_rtsp(void *ctx){ MOTION_LOG(WRN, TYPE_NETCAM, SHOW_ERRNO, "%s: get interrupt time failed"); } if ((interrupttime.tv_sec - rtsp->startreadtime.tv_sec ) > 10){ - MOTION_LOG(WRN, TYPE_NETCAM, NO_ERRNO, "%s: Camera timed out for %s",rtsp->path); + MOTION_LOG(WRN, TYPE_NETCAM, NO_ERRNO, "%s: Camera timed out for %s", rtsp->netcam_url); rtsp->interrupted = 1; return 1; } else{ @@ -299,7 +299,7 @@ static int netcam_interrupt_rtsp(void *ctx){ MOTION_LOG(WRN, TYPE_NETCAM, SHOW_ERRNO, "%s: get interrupt time failed"); } if ((interrupttime.tv_sec - rtsp->startreadtime.tv_sec ) > 30){ - MOTION_LOG(WRN, TYPE_NETCAM, NO_ERRNO, "%s: Camera timed out for %s",rtsp->path); + MOTION_LOG(WRN, TYPE_NETCAM, NO_ERRNO, "%s: Camera timed out for %s", rtsp->netcam_url); rtsp->interrupted = 1; return 1; } else{ @@ -464,7 +464,7 @@ static int netcam_rtsp_open_context(netcam_context_ptr netcam){ if (netcam->rtsp->path == NULL) { if (netcam->rtsp->status == RTSP_NOTCONNECTED){ - MOTION_LOG(ERR, TYPE_NETCAM, NO_ERRNO, "%s: Null path passed to connect (%s)", netcam->rtsp->path); + MOTION_LOG(ERR, TYPE_NETCAM, NO_ERRNO, "%s: Null path passed to connect"); } return -1; } @@ -523,7 +523,7 @@ static int netcam_rtsp_open_context(netcam_context_ptr netcam){ if ((retcd < 0) || (netcam->rtsp->interrupted == 1)){ if (netcam->rtsp->status == RTSP_NOTCONNECTED){ av_strerror(retcd, errstr, sizeof(errstr)); - MOTION_LOG(ERR, TYPE_NETCAM, NO_ERRNO, "%s: unable to open input(%s): %s", netcam->rtsp->path,errstr); + MOTION_LOG(ERR, TYPE_NETCAM, NO_ERRNO, "%s: unable to open input(%s): %s", netcam->rtsp->netcam_url, errstr); } av_dict_free(&opts); //The format context gets freed upon any error from open_input. @@ -941,6 +941,12 @@ int netcam_setup_rtsp(netcam_context_ptr netcam, struct url_t *url){ netcam_url_free(url); + /* + * Keep a pointer to the original URL for logging purposes + * (we don't want to put passwords into the log) + */ + netcam->rtsp->netcam_url = cnt->conf.netcam_url; + /* * Now we need to set some flags */ diff --git a/netcam_rtsp.h b/netcam_rtsp.h index dd827d17..be3e52d6 100644 --- a/netcam_rtsp.h +++ b/netcam_rtsp.h @@ -23,6 +23,7 @@ struct rtsp_context { char* path; char* user; char* pass; + const char* netcam_url; int interrupted; enum RTSP_STATUS status; struct timeval startreadtime;