Skip to content
This repository has been archived by the owner on Jan 15, 2019. It is now read-only.

[dev.icinga.com #261] wrong parameter used in ndo2db_db_query call in ndo2db_handle_acknowledgementdata #113

Closed
icinga-migration opened this issue Jan 28, 2010 · 2 comments

Comments

@icinga-migration
Copy link

This issue has been migrated from Redmine: https://dev.icinga.com/issues/261

Created by brucep on 2010-01-28 19:38:58 +00:00

Assignee: mfriedrich
Status: Resolved (closed on 2010-01-28 21:45:05 +00:00)
Target Version: 1.0.1
Last Update: 2010-01-28 21:45:05 +00:00 (in Redmine)


In dbhandlers.c, approx. line 3419, the call to ndo2db_db_query is wrong. Here is the relevant code:

if(asprintf(&buf1,"(instance_id, entry_time, entry_time_usec, acknowledgement_type, object_id, state, author_name, comment_data, is_sticky, persistent_comment, notify_contacts) VALUES (%lu, %s, %lu, %d, %lu, %d, '%s', '%s', %d, %d, %d)"
,idi->dbinfo.instance_id
,ts[0]
,tstamp.tv_usec
,acknowledgement_type
,object_id
,state
,es[0]
,es[1]
,is_sticky
,persistent_comment
,notify_contacts
)==-1)
buf1=NULL;

if(asprintf(&buf,"INSERT INTO %s %s"
,ndo2db_db_tablenames[NDO2DB_DBTABLE_ACKNOWLEDGEMENTS]
,buf1
)==-1)
buf=NULL;
free(buf1);

result = ndo2db_db_query(idi, buf1);

The call to ndo2db_db_query() should be passing buf as the second parameter, not buf1. There's also an extra call to free(buf1) slightly further down in the code.

Changesets

2010-01-28 21:35:43 +00:00 by mfriedrich 0b576e4

fix acknowledgments query

wrong buffer freed/set as query to db

fixes #261
@icinga-migration
Copy link
Author

Updated by mfriedrich on 2010-01-28 21:29:18 +00:00

  • Assigned to set to mfriedrich
  • Target Version set to 1.0.1

thanks for debugging and pointing to the code. It's one of those things which have been rewritten due to useless unique constraint matching but did not happen while testing.

I will apply a quickfix right now :)

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2010-01-28 21:45:05 +00:00

  • Status changed from New to Resolved
  • Done % changed from 0 to 100

Applied in changeset commit:"0b576e4d452feed5f2241fcce27d0e6f009884f8".

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant